So this morning I try to connect to SQLite database using PDO and also create a table. Firstly, I create a file called db.sqlite, and then create my connection and execute a create table query, but the execute pdo function always returns false.
$pdo = new PDO("sqlite:db.sqlite");
$STH = $pdo->prepare(
'CREATE TABLE "users" (
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL ,
"full_name" VARCHAR,
"description" TEXT,
"token" INTEGER);
');
$STH->execute();
So what I did next is to remove the db.sqlite from the connection and replace with :memory: to create a db in memory, which works perfectly.
$pdo = new PDO("sqlite::memory:");
So I am confused, why can I use :memory: and not the file, and how do I fix it?

To access a database on disk, append the absolute path to the DSN prefix.See - absolute.$dsn = "sqlite:" . __DIR__ .'/db.sqlite';. On a separate note: I define a constant for thehomeor top directory of my site., calledAPP_HOME_ROOT. All data can be found in adatadirectory under that root. so Idefine('APP_DATA_ROOT,' APP_DATA_ROOT . '/data');. And, yes - this works on windows as well.define('APP_DATA_ROOT', APP_HOME_ROOT . '/data'). whatever - you get the idea? ;-/