SQLite Forum

Opening a database without creating a new one and Error logging
Login
This is a question for your PHP documentation, not sqlite. sqlite, by default, create a database if it doesn't already exist. You can solve that in 2 ways with PHP: 1) learn (vai the PHP docs) how to detect whether a file exists before trying to open it or 2) learn (via the PHP docs) how to tell the PHP sqlite bindings to *not* create a database if it doesn't already exist.

```
$db = new MyDB();
if(!$db)
{
   echo "Unable to open database";
}
```

That cannot behave how you expect it to (the `new` keyword simply doesn't work like that), but, again, this is an sqlite forum, not a PHP forum, so i'll redirect you to the PHP documentation and forums for why that cannot work.