lite_error_string(sqlite_last_error($handle))); sqlite_query($handle, "INSERT INTO books (title, author) VALUES (''Three Men In A Boat'', ''Jerome K. Jerome'')") or die("Error in query: ".sqlite_error_string(sqlite_last_error($handle))); sqlite_query($handle, "INSERT INTO books (title, author) VALUES (''A Study In Scarlet'', ''Arthur Conan Doyle'')") or die("Error in query: ".sqlite_error_string(sqlite_last_error($handle))); sqlite_query($handle, "INSERT INTO books (title, author) VALUES (''Alice In Wonderland'', ''Lewis Carroll'')") or die("Error in query: ".sqlite_error_string(sqlite_last_error($handle))); // print success message echo "<i>Database successfully initialized!"; // all done // close database file sqlite_close($handle); ?>
SERVER[''DOCUMENT_ROOT'']."/../library3.db"; // create database object $db = new SQLiteDatabase($file) or die("Could not open database"); // create database $db->query("CREATE TABLE books (id INTEGER PRIMARY KEY, title VARCHAR(255) NOT NULL, author VARCHAR(255) NOT NULL)") or die("Error in query"); // insert records $db->query("INSERT INTO books (title, author) VALUES (''The Lord Of The Rings'', ''J.R.R. Tolkien'')") or die("Error in query"); $db->query("INSERT INTO books (title, author) VALUES (''The Murders In The Rue Morgue'', ''Edgar Allan Poe'')") or die("Error in query"); $db->query("INSERT INTO books (title, author) VALUES (''Three Men In A Boat'', ''Jerome K. Jerome'')") or die("Error in query"); $db->query("INSERT INTO books (title, author) VALUES (''A Study In Scarlet'', ''Arthur Conan Doyle'')") or die("Error in query"); $db->query("INSERT INTO books (title, author) VALUES (''Alice In Wonderland'', ''Lewis Carroll'')") or die("Error in query"); // print success message echo "<i>Database successfully initialized!"; // all done // destroy database object unset($db); ?>