I am trying to port a PHP application from MySQL to SQLite, and some things that worked before just stopped working. I use PDO through my own database shell class (the class is singleton, it seems logical to do it like this).
Problem: When trying to execute a request in a prepared statement, it generates a "fatal error: call of the execute () member function for a non-object ...".
Relevant code (tapering to this after a few hours of var_dumps and try-catch):
Connection string:
$this->connection = new PDO("sqlite:"._ROOT."/Storage/_sqlite/satori.sdb");
Obviously, the $ connection variable here is a private variable from the class.
The error is here (inside the function that should perform the database insert):
try{ $statement = self::getInstance()->connection->prepare($sql); }catch (PDOException $e){ print $e->getMessage; } try{ var_dump($statement); $statement->execute($input); }catch (Exception $e){ print $e->getMessage(); }
More precisely, this happens when I try to execute $ statement-> execute ($ input).
Any help appreciated. Thanks.
source share