I am using the following code to create tables within a MySQL database:
The database parameters and variables in the top three lines are defined much earlier in my code and are not printed in the above code.
The script connects to the database with no problems. I am receiving the following error when the code creates the database tables:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'release varchar(10) NOT NULL default '' )' at line 1
I am using MySQL version 5.5
I would appreciate any help in fixing ALL of the above syntax for this MySQL version.
Thanks so much
Code:
// Connect to the database
mysql_connect("$mysql_host","$mysql_username","$mysql_passwd") or die (mysql_error());
mysql_select_db("$mysql_dbase") or die (mysql_error());
// Create the tables
mysql_query("CREATE TABLE $redir_table ( host varchar(100) NOT NULL default '', name varchar(25) NOT NULL default '', vname varchar(25) NOT NULL default '', passwd varchar(50) NOT NULL default '', email varchar(100) NOT NULL default '', url varchar(100) NOT NULL default '', title varchar(100) NOT NULL default '', descr text NOT NULL, keyw text NOT NULL, counter int(11) default NULL, robots varchar(50) NOT NULL default '', news char(3) NOT NULL default '', revisit text NOT NULL, time varchar(15) NOT NULL default '', ip varchar(20) NOT NULL default '', cat varchar(50) NOT NULL default '', lasttime varchar(15) NOT NULL default '', stats char(3) NOT NULL default '', mail char(3) NOT NULL default '', adtype varchar(15) NOT NULL default '', acticode varchar(15) NOT NULL default '', active char(3) NOT NULL default '', PRIMARY KEY (host), UNIQUE KEY host (host) )") or die (mysql_error());
mysql_query("CREATE TABLE $options_table ( home varchar(50) NOT NULL default '', sitetitle varchar(150) NOT NULL default '', adminemail varchar(50) NOT NULL default '', username varchar(50) NOT NULL default '', password varchar(50) NOT NULL default '', domainip varchar(15) NOT NULL default '', maindomain varchar(50) NOT NULL default '', mailtoadmin char(3) NOT NULL default '', language varchar(20) NOT NULL default '', multiple char(3) NOT NULL default '', minlength char(2) NOT NULL default '', maxlength char(2) NOT NULL default '', reserved text NOT NULL, forbidden text NOT NULL, autoappr char(3) NOT NULL default '', theme varchar(50) NOT NULL default '', release varchar(10) NOT NULL default '' )") or die (mysql_error());
mysql_query("CREATE TABLE $domain_table ( domain varchar(50) NOT NULL default '' )") or die (mysql_error());
mysql_query("CREATE TABLE $category_table ( category varchar(50) NOT NULL default '', advtype varchar(20) NOT NULL default '', adurl varchar(150) NOT NULL default '', height varchar(4) NOT NULL default '', width varchar(4) NOT NULL default '' )") or die (mysql_error());
mysql_query("CREATE TABLE $visitor_table ( host varchar(100) NOT NULL default '', date varchar(15) NOT NULL default '', ip varchar(20) NOT NULL default '', agent varchar(250) NOT NULL default '', ref varchar(250) NOT NULL default '', timestamp varchar(15) NOT NULL default '' )") or die (mysql_error());
The database parameters and variables in the top three lines are defined much earlier in my code and are not printed in the above code.
The script connects to the database with no problems. I am receiving the following error when the code creates the database tables:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'release varchar(10) NOT NULL default '' )' at line 1
I am using MySQL version 5.5
I would appreciate any help in fixing ALL of the above syntax for this MySQL version.
Thanks so much