I’m trying to update the variables into the sqlite3 database. The query is working in sqlite browser but when I want to update through my web, it gives me ‘Fatal error: Call to a member function execute() on a non-object’.
Code:
$DB = new PDO('sqlite:database/Sample.sqlite3');
$No = 1;
$Name = 'John';
$RecordNo = 2;
$statement ="update Sample set No =".$No.", Name='".Name."', Date='2012-05-14' where RecordNo=".$RecordNo;
$update = $DB->prepare($statement);
$update->execute();
The fatal error was at the statement of ‘$update->execute();’ where it should execute as there is no syntax errors or code. Kindly advise.
An alternative…