Kryllster Posted June 17, 2009 Share Posted June 17, 2009 <?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 Quote Link to comment Share on other sites More sharing options...
tradm Posted June 17, 2009 Share Posted June 17, 2009 <?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); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.