Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create new database in php with SQLite3

How to create a new database in php with SQLite3 ?
$db = new SQLite3($dbname);
just open, but I want to create if not exist.
thanks you for your help.

like image 281
François MENTEC Avatar asked May 06 '15 18:05

François MENTEC


1 Answers

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.

like image 157
Jay Blanchard Avatar answered Sep 24 '22 12:09

Jay Blanchard