dimanche 15 mars 2015

PDO connect to a database that currently exists instead of create a new database

I am using PDO class to connect to a sqlite database, here is the code I am using:



public function __construct(){
parent::__construct("sqlite: userquestion.db");

$this->exec("PRAGMA foreign_keys = ON;"); // enable foreign keys
}


However, when I instantiate this class, it creates a new database, instead I want to connect to a database that already exists.


PS: yes, I am using the correct directory.


Aucun commentaire:

Enregistrer un commentaire