PDO exec doesn't work, database remains empty
I have written this code:
$database = new PDO('sqlite:./shoxxdb.sqlite3');
if (!$database) {
include './shoxx/error.php';
exit;
}
$database->exec('CREATE TABLE IF NOT EXISTS Feeds (ID UNIQUE PRIMARY KEY, Name, URL)');
$database->exec('CREATE TABLE IF NOT EXISTS Articles (ID UNIQUE PRIMARY KEY, FeedID, Title, Body, URL, Date)');
But when ran, shoxxdb.sqlite3
remains empty, even though the permissions are set to 0666
. Surprisingly I don't get any error message.
I have PHP versi开发者_运维问答on 5.3.4 on Mac OS X.
Can anyone help me please? This is driving me crazy.
http://www.php.net/manual/en/ref.pdo-sqlite.php "The folder that houses the database file must be writeable." Is it?
And about errors, pls check, that you have enable them in php.ini -- may be you have errors, but they didn't displayed.
精彩评论