开发者

PDO exec doesn't work, database remains empty

开发者 https://www.devze.com 2023-03-09 12:41 出处:网络
I have written this code: $database = new PDO(\'sqlite:./shoxxdb.sqlite3\'); if (!$database) { include \'./shoxx/error.php\';

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消