How To Show Sql Errors In Sqlite?
Using SQLite in PHP (thus using PDO), I have this code: try { $db = new PDO('sqlite:C:\Program Files\Spiceworks\db\spiceworks_prod.db'); echo 'Done.'; $query
Solution 1:
You need to tell PDO to throw exceptions. You can do that by adding the following line after you connect to the database:
$db = new PDO("sqlite:C:\Program Files\Spiceworks\db\spiceworks_prod.db");
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
That way you can catch all exceptions except for a possible problem with the first line, the database connection itself.
Post a Comment for "How To Show Sql Errors In Sqlite?"