François MENTEC
François MENTEC

Reputation: 1304

Create new database in php with SQLite3

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

Answers (1)

Jay Blanchard
Jay Blanchard

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

Related Questions