Code follows, had trouble attaching the txt ffile previously.
I am trying to find why i am receiving errors whille trying to create the following MySql Database. I get error on the line INSERT INTO .... can anyone help.
I have attached a txt file with the code
Any help much appreciated
<?
require( "functions.php" );
session_start();
if( session_is_registered( "name" ) && session_is_registered( "passwd" ) &&
$name == $adminName && $passwd == $adminPasswd ):
$dbLink = mysql_connect( $dbHost, $dbUser, $dbPasswd );
mysql_create_db( $dbName, $dbLink );
mysql_select_db( $dbName );
$query1 = "CREATE TABLE Content
CREATE TABLE Content (
ID int(11) NOT NULL auto_increment,
section varchar(16),
page varchar(85) NOT NULL,
body text,
date_updated date,
writer varchar(30),
email varchar(40),
PRIMARY KEY (ID)
)";
$query2 = "CREATE TABLE users
CREATE TABLE users (
user_id int(11) NOT NULL auto_increment,
user_name varchar(32),
user_email varchar(64),
user_password varchar(8),
PRIMARY KEY (user_id)
)";
//I am getting PARSE ERROR at this part. I presume i can create table and then add straight afterwards
INSERT INTO users VALUES( '1', 'sssss', 'mike@ssss.com.au', 'ssseee');
INSERT INTO users VALUES( '3', 'becnsw', '', 'updates');
mysql_query( $query1 ) or error( mysql_error() );
mysql_query( $query2 ) or error( mysql_error() );
displayHeader( "Database created" );
echo "<center><h4>Database has been created</h4></center>";
echo "<p align=center><a href=admin.php>Back to admin</a></center></p>";
mysql_close( $dbLink );
displayFooter();
else:
error( "Fatal error, you don't have permission to perform this action" );
endif;
?>