I want to connect to a database that already exists using PDO and sqlite in PHP, and here is the code I have:
class Database extends PDO{
public function __construct(){
parent::__construct("sqlite: userquestion.db");
$this->exec("PRAGMA foreign_keys = ON;"); // enable foreign keys
}
}
However, when you instantiate this class, it creates a new userquestion.db
file, rather than simply opening a connection to the existing file.
PS: I already checked and I am using the name and directory correctly.