I have PHP 5.2.3, apache2.x, MySQL 5.x on a Linux machine. Everything was working fine until yesterday. This morning all of a sudden one of the PHP files started to throw “Fatal error: Call to a member function execute() on a non-object in”. I use PDO (prepare, execute, close cursor etc). Have you ever come across this problem? does someone know a fix for this, please?
Many thanks,
R
As Alan says, the problem is probably that
prepareis returningfalserather than aPDOStatement. The best way to debug this is to turn warnings on. To do this, put this code right after you initialise PDO:This will mean that a PHP warning will be raised by PDO when the prepare statement fails. This should contain information that will help you debug the problem.