Error connecting to bank!

Asked

Viewed 1,038 times

-1

I made a page to register information of a student in the mysql database, but when sending the form data, it returns these errors: Notice: Undefined variable: mysqli in C: xampp htdocs Easytec cadastra_usuario.php on line 12

Fatal error: Uncaught Error: Call to a Member Function query() on null in C: xampp htdocs Easytec cadastra_usuario.php:12 Stack trace: #0 {main} thrown in C: xampp htdocs Easytec cadastra_usuario.php on line 12

register: inserir a descrição da imagem aqui

Connection: inserir a descrição da imagem aqui

If anyone can help I’d appreciate it!

  • 2

    post your code so that everyone can see better what the problem is and can guide you

  • Blz, I added by photo since the site ate my code

  • 2

    in the.php connection no need to create this $mysqli out of function, and tbm needed you to assign your role’s Return to some registry variable.php

  • Let me see, so the right thing is to put $mysqli as parameter? Is that I am layman in php

  • takes the $mysqli that is outside of the function opens.In the connection.php file, in the register.php you put this below include: $mysqli = open() and forehead.

1 answer

1


Lucas, in your registration file you need to call the open method.
Thus:

<?php
  include "conexao.php";
  $mysqli = abrirConexao();

  //Aqui o restante da sua classe cadastro.

?>

And in your.php connected file you can delete that first one $mysqli that is just above the function abrirConexao().

  • That’s right man, mt obg!

  • @Lucas_squ4nchy, I’m glad it worked out! If the response helped you consider it correct to help other people with the same question.

  • Yeah, see you for the warning!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.