Reputation: 1304
How to create a new database in PHP with SQLite3?
$db = new SQLite3($dbname);
just opens the db, but I want to create if not exist.
Upvotes: 12
Views: 20379
Reputation: 34426
To create you do use the new
statement:
// create or open (if exists) the database
$database = new SQLite3('myDatabase.sqlite');
If you have named a database that doesn't exist it should get created.
Upvotes: 18