CHAPTER 6 – SQLite – Error Handling
SQLite's error handling is a bit flakey because each of the query functions might throw a warning. It is therefore important to prepend the query functions with the "shut-up" operator @. The result of the function then needs to be checked against FALSE to see if the query succeeded. I f i t d i d n o t s u c c e e d , y o u c a n u s e s q l i t e _ l a s t _ e r r o r ( ) a n d sqlite_error_string() to retrieve a textual description of the error. Unfortu- nately, this error message is not very descriptive, either.
SQLite's constructor might also throw an SQLiteException, which you need to handle yourself (with a try...catch block). There will be some future work on SQLite's error handling, but that's likely something for PHP 5.1.