-1
Recently I changed all my code mysql
for mysqli
. It just gave me a lot of headaches.
He gives me the following mistakes:
Notice: Undefined variable: conexao in D:\Programas\wamp64\www\admin\css\header.php on line 44
Warning: mysqli_query() expects parameter 1 to be mysqli, null given in D:\Programas\wamp64\www\admin\css\header.php on line 44
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, null given in D:\Programas\wamp64\www\admin\css\header.php on line 45
Notice: Undefined variable: conexao in D:\Programas\wamp64\www\admin\css\Cadastro.class.php on line 15
Warning: mysqli_query() expects parameter 1 to be mysqli, null given in D:\Programas\wamp64\www\admin\css\Cadastro.class.php on line 15
Couldn’t insert when to insert.
Currently my codes are in:
index php.
php.
css/header.php <- is linked
css/DB.class.php
css/Cadastro.class.php <- is linked
DB.class.php:
<?php
class DB{
public function conectar(){
$conexao=mysqli_connect("localhost","root","","painel")or die("Não foi possível conectar na database.");
return $conexao;
}
}
?>
Where did I go wrong?
Thanks Fernando, the mistakes have decreased. Now is giving the following mistakes:
Notice: Undefined variable: conectar in D:\Programas\wamp64\www\admin\css\Cadastro.class.php on line 15
Warning: mysqli_query() expects parameter 1 to be mysqli, null given in D:\Programas\wamp64\www\admin\css\Cadastro.class.php on line 15
I changed from $conexao
for $conectar
in the archives header.php
and Cadastro.class.php
. 2 errors left, only 2 more.
Where and how it’s calling is variable?
– Jonathan de Toni
How’s the
header.php
?– Francisco
It is linked in the topic @Jonathandetoni e Francisco
– Lucas Josivan
Put the relevant parts of the codes here in the question, so that everyone can have access
– Jefferson Quesado