I searched for this, but most of the questions were about mysql/mysqli. I couldn't find out why I get an error which is the next:
Fatal error: Uncaught Error: Call to undefined function connect() in C:\xampp\htdocs\xy\xy.php:11 Stack trace: #0 {main} thrown in C:\xampp\htdocs\xy\xy.php on line 11
The way I got this error message: I have an oop php file with a class in it and within that there's a function (function connect()), this is for database connection.
class dbh {
private $servername;
private $username;
private $password;
private $dbname;
protected function connect(/*$conn*/) {
$this->servername = "localhost";
$this->username = "root";
$this->password = "";
$this->dbname = "carsale";
$conn = new mysqli($this->servername, $this->username, $this->password, $this->dbname);
return $conn;
}
I require the separated php on the main page, and I call the connect() function, but instead of connecting it gives the error and this is not about mysqli.
(I couldn't find any typos.)