hello community I'm just learning the object-oriented programming for reasons of scalability in my application and well I have this code to establish connection to the database ..
file config.php
$host="localhost";
$user="root";
$pass="";
$DBname="login";
and lugeo conexion.php
require"config.php";
class conexion{
public function dbConnect(){
$conexion= new mysqli($host,$user,$pass,$DBname);
if (!$this->conexion) {
echo"conxion width db fail: ".$this->conexion->coonect_error;
return;
}
}
}
launches the following error ...
Notice: Undefined variable: host in C: \ xampp \ htdocs \ pooClass_php \ conexion.php on line 16
Notice: Undefined variable: user in C: \ xampp \ htdocs \ pooClass_php \ conexion.php on line 16
Notice: Undefined variable: pass in C: \ xampp \ htdocs \ pooClass_php \ conexion.php on line 16
Notice: Undefined variable: DBname in C: \ xampp \ htdocs \ pooClass_php \ conexion.php on line 16
Notice: Undefined variable: conn in C: \ xampp \ htdocs \ pooClass_php \ index.php on line 30
someone who can guide me a little and can help me understand some concepts? thanks!