I am new to programming in PHP and I\'m making a PHP class that receives queries but when summoned gives me the error \"PHP Fatal error: Call to a member function query () on nu
Your variable scopes are wrong. Try this:
function conectarDB($svrName, $user, $pwd,$dbName){ $this->conexion = mysqli_connect($svrName, $user, $pwd,$dbName); return $this->conexion; } function consultaDB($consult){ $result = $this->conexion->query($consult); return $result; }