Jump to content


Photo

Light SQLite trouble..


  • Please log in to reply
No replies to this topic

#1 jdoe

jdoe
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 11 May 2006 - 10:33 AM

Having just a little trouble with SQLite. I'm running 5.1.3 CGI, with the sqlite, pdo, and (unnecessarily) the pdo_sqlite extensions enabled, on Apache 2.0.55 under XP Pro.

I'm trying to, at the head of my script, have SQLite create a table as long as one of the same name doesn't already exist. I read the correct syntax is "CREATE TABLE IF NOT EXISTS," but when I try this, as in this example code:

<?php

$db = new SQLiteDatabase("test.db");

$db->query("CREATE TABLE IF NOT EXISTS foo(id INTEGER PRIMARY KEY, name CHAR(255)");

?>

I get the following error:

Warning: SQLiteDatabase::query() [function.SQLiteDatabase-query]: near "NOT": syntax error in test.php on line 5

What's causing this; what am I doing wrong?

I know it's gotta be something simple, but it's driving me nuts! After a few tests, I'm excited to work with this terrific database system, absolutely perfect for my application, but am stuck due to this!

Any help's much obliged!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users