"php mysql pdo get fatal error when calling 2 functions to run sql statement in the same file" Code Answer

3

the problem here is : you dont use the class db to make all the database call.

you define protected $conn; in the class db but use it in the class item.

you need to make a public function makequery in class db, its better than creating a constructor in the class item (all database query will be executed by the class db).

or you can do class item extends db to use $this->conn->query($sql);

By zbynour on July 3 2022

Answers related to “php mysql pdo get fatal error when calling 2 functions to run sql statement in the same file”

Only authorized users can answer the Search term. Please sign in first, or register a free account.