Hello - I am trying to learn how to write a php program that uses sqlite commands. I use the following file named hist.php to try to load a database, but I get the error (on the fetch() line near the bottom, I assume)
Fatal error: Call to a member function fetch() on a non-object in /Library/WebServer/Documents/hist.php on line 26 Can anyone help? <?php try { $dbHandle = new PDO('sqlite:'."/Users/me/junk.txt"); } catch( PDOException $exception ){ die($exception->getMessage()); } $sqlCreateTable = 'create table tab(i0,i1,i2,i3,i4,t0,ID0,t1,t2,t3,t4,s,l,date,d)'; $dbHandle->exec($sqlCreateTable); // remove or 'comment out' this line after first run $sqlcmd = '.mode tabs'; $dbHandle->exec($sqlcmd); $sqlcmd = '.import "/Users/me/History/HistTDD.txt" tab'; $dbHandle->exec($sqlcmd); $sqlcmd = '.mode list'; $dbHandle->exec($sqlcmd); $sqlcmd = 'select count(*) as view from tab'; $result = $dbHandle->query($sqlcmd); $pageView = $result->fetch(); echo 'Result='.$pageView['view']; ?> -- View this message in context: http://old.nabble.com/Sqlite-and-php-tp26754013p26754013.html Sent from the SQLite mailing list archive at Nabble.com. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users