Everywhere I have looked says it is supported and it works without the "IF NOT EXISTS".
There is the rest of the code - some columns I am using the try catch in replace of the "IF NOT EXISTS"
and it works without the "IF NOT EXISTS"
$mysql = "CREATE TABLE startup (row_id INTEGER PRIMARY KEY, ";
$mysql .= "games TEXT NOT NULL, ";
$mysql .= "user_id TEXT NOT NULL, ";
.
.
.
.
$mysql .= "age TEXT ";
.
.
$mysql .= "); ";
if ($db = sqlite_open('jx3.db', 0666, $sqliteerror)) {
//catch if database is already there
try{
sqlite_query($db,$mysql);
} catch(Exception $e){
}
$mysql = "INSERT INTO startup (games,user_id,age";
.
.
.
.
$mysql .= ") VALUES (\"";
$mysql .= $var_games . "\",\"" .$var_id . "\",\"";
.
.
.
.
$mysql .= $var_age . "\")";
sqlite_query($db, $mysql) or die("Error in query: ".sqlite_error_string(sqlite_last_error($db)));
But when I use the "IF NOT EXISTS" it gives me a error
I do not understand why??
$mysql = "CREATE TABLE IF NOT EXISTS startup (row_id INTEGER PRIMARY KEY, ";
$mysql .= "games TEXT NOT NULL, ";
$mysql .= "user_id TEXT NOT NULL, ";
.
.
.
.
$mysql .= "age TEXT ";
.
.
$mysql .= "); ";
if ($db = sqlite_open('jx3.db', 0666, $sqliteerror)) {
sqlite_query($db,$mysql);
$mysql = "INSERT INTO startup (games,user_id,age";
.
.
.
.
$mysql .= ") VALUES (\"";
$mysql .= $var_games . "\",\"" .$var_id . "\",\"";
.
.
.
.
$mysql .= $var_age . "\")";
sqlite_query($db, $mysql) or die("Error in query: ".sqlite_error_string(sqlite_last_error($db)));