I have a class to connect to my database, cut stuff and return things from a db request. Anyway, the problem I am facing is that I try to call the runQuery() method, but every time I try, I get this error:
Fatal error: call to undefined runQuery () function in DatabaseConnector.php line 22
Any ideas maybe? I know that
runQuery is private, but it is within the same class. Just for the blows, I changed it in public, and still got the same error :(
final class DatabaseConnector { private $db; public function DatabaseConnector() { // constructor } public function connectMySQL($host, $user, $passwrd, $db, $query) { @ $db = new mysqli($host, $user, $passwrd, $db); if (mysqli_connect_errno()) { return mysqli_connect_errno(); } else { $queryResult = runQuery($query); return $queryResult; } } private function runQuery($query) { $result = $db->query($query); return $result; } }
source share