Jump to content

[SOLVED] What is wrong with this code?


Recommended Posts

<?php

$database = new SQLiteDatabase('../database/crimson_forum.db', $error);

sqlite_exec($database);

// create databas
$db = sqlite_open('../database/crimson_forum.db') or die("Could Not open Database");

$question = 'CREATE Table forum_question (
"id", INTEGER PRIMARY KEY,
"topic" TEXT NOT NULL,
"detail" TEXT NOT NULL,
"name" TEXT NOT NULL,
"email" TEXT NOT NULL,
"datetime" TEXT NOT NULL,
"view" INTEGER NOT NULL,
"reply" INTEGER NOT NULL);
)

$answer = 'CREATE TABLE forum_answer (
"question_id" INTEGER NOT NULL,
"a_id" INTEGER NOT NULL,
"a_name" TEXT NOT NULL,
"a_email" TEXT NOT NULL,
"a_answer"TEXT NOT NULL,
"a_datetime" TEXT NOT NULL,
"a_id" INTEGER UNIQUE);

sqlite_exec($db, $question) or die("Could Not Insert Table From Sql");

sqlite_exec($db, $answer) or die("Could Not Insert Table From Sql");

sqlite_close($db);
?>

 

I am trying to create the database and then set the tables but Im having no luck! Any help would be appreciated?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/162524-solved-what-is-wrong-with-this-code/
Share on other sites

<?php

$database = new SQLiteDatabase('../database/crimson_forum.db', $error);

sqlite_exec($database);

// create databas
$db = sqlite_open('../database/crimson_forum.db') or die("Could Not open Database");

$question = 'CREATE Table forum_question (
"id", INTEGER PRIMARY KEY,
"topic" TEXT NOT NULL,
"detail" TEXT NOT NULL,
"name" TEXT NOT NULL,
"email" TEXT NOT NULL,
"datetime" TEXT NOT NULL,
"view" INTEGER NOT NULL,
"reply" INTEGER NOT NULL)';


$answer = 'CREATE TABLE forum_answer (
"question_id" INTEGER NOT NULL,
"a_id" INTEGER NOT NULL,
"a_name" TEXT NOT NULL,
"a_email" TEXT NOT NULL,
"a_answer"TEXT NOT NULL,
"a_datetime" TEXT NOT NULL,
"a_id" INTEGER UNIQUE)';

sqlite_exec($db, $question) or die("Could Not Insert Table From Sql");

sqlite_exec($db, $answer) or die("Could Not Insert Table From Sql");

sqlite_close($db);
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.