Simon, why would you recommend not using PDO? Does the SQLite3 extension perform better, or does it boil down to personal preference?
On August 5, 2017 1:35:43 PM EDT, Simon Slavin <slav...@bigfraud.org> wrote: > > >On 5 Aug 2017, at 10:53am, Edmondo Borasio <edmondobora...@gmail.com> >wrote: > >> Hey, do you know where I can find good instructions on how to use >SQLITE in >> PHP? > >I used to do that for a living. > >First, use the sqlite3 module. Don’t use the PDO module which can >access many types of database. So you should be doing "new SQLite3()" >like this: > > $db = new SQLite3('mysqlitedb.db'); > $results = $db->query('SELECT bar FROM foo'); > while ($row = $results->fetchArray()) { > var_dump($row); > } > >Second, I have not found any better examples than you find in the >documentation > ><http://php.net/manual/en/book.sqlite3.php> > >which is rather annoying since there aren’t many examples of some >calls. > >Third, I recommend you try to do object-oriented programming in PHP >where possible, and the sqlite3 module works well with that. So >although the call provided is > > $row = $results->fetchArray() > >I frequently do > > $row = (object) $results->fetchArray() > >and the var_dump line in the above example will show you how this >changes what you get. > >Simon. >_______________________________________________ >sqlite-users mailing list >sqlite-users@mailinglists.sqlite.org >http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users -- Sent from my Android device with K-9 Mail. Please excuse my brevity. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users