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
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);
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.