I have the following problem when loading data on the web:
Notice: Undefined variable: connection in C: \ xampp2 \ htdocs \ Modules \ class_buscar.php on line 41
Warning: mysqli_query () expects parameter 1 to be mysqli, null given in C: \ xampp2 \ htdocs \ Modules \ class_buscar.php on line 41
Warning: mysqli_fetch_array () expects parameter 1 to be mysqli_result, null given in C: \ xampp2 \ htdocs \ Modules \ class_buscar.php on line 42
Where in the file class_buscar.php
I have this that are lines 41 and 42: **
class Consultar_Profesor{
private $consulta;
private $fetch;
function __construct($codigo){
$this->consulta=mysqli_query($conexion,"SELECT * FROM profesor WHERE doc='$codigo'");
$this->fetch = mysqli_fetch_array($this->consulta);
}
function consultar($campo){
return $this->fetch[$campo];
}
}
and the file of conexion
I have it like this:
$conexion = mysqli_connect("localhost","root","");
mysqli_select_db($conexion,"basedatos1");
Help please thanks