scarhand Posted October 29, 2007 Share Posted October 29, 2007 Why am I getting the error "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 '; CREATE TABLE bans ( id int unsigned NOT NULL auto_increment, ' at line 4" for this simple query? <?php mysql_query(" CREATE TABLE admin ( adminpassword text NOT NULL, PRIMARY KEY (adminpassword) ); CREATE TABLE bans ( id int unsigned NOT NULL auto_increment, ip text NOT NULL, PRIMARY KEY (id) ); CREATE TABLE censors ( id int unsigned NOT NULL auto_increment, word text NOT NULL, PRIMARY KEY (id) ); CREATE TABLE config ( name text NOT NULL, value text NOT NULL, PRIMARY KEY (name) ); CREATE TABLE shouts ( id int unsigned NOT NULL auto_increment, name text NOT NULL, message text NOT NULL, ip text NOT NULL, PRIMARY KEY (id) ); CREATE TABLE styles ( name text NOT NULL, value text NOT NULL, PRIMARY KEY (name) ); INSERT INTO admin (adminpassword) VALUES ('admin123'); INSERT INTO bans (ip) VALUES ('123.456.7.89'); INSERT INTO censors (word) VALUES ('fuck'); INSERT INTO censors (word) VALUES ('shit'); INSERT INTO censors (word) VALUES ('cunt'); INSERT INTO censors (word) VALUES ('bitch'); INSERT INTO censors (word) VALUES ('nigger'); INSERT INTO censors (word) VALUES ('coon'); INSERT INTO censors (word) VALUES ('spic'); INSERT INTO censors (word) VALUES ('beaner'); INSERT INTO censors (word) VALUES ('gook'); INSERT INTO censors (word) VALUES ('chink'); INSERT INTO config (name, value) VALUES ('numshouts', '20'); INSERT INTO config (name, value) VALUES ('maxname', '25'); INSERT INTO config (name, value) VALUES ('maxshout', '255'); INSERT INTO config (name, value) VALUES ('wrapwords', '20'); INSERT INTO config (name, value) VALUES ('usecookies', 'yes'); INSERT INTO config (name, value) VALUES ('smilies', 'yes'); INSERT INTO shouts (name, message, ip) VALUES ('Dion Design', 'Congrats! It appears your Shoutboxer has been installed successfully!', '123.456.7.89'); INSERT INTO styles (name, value) VALUES ('bannedtxtcolor', '#FFFFFF'); INSERT INTO styles (name, value) VALUES ('maintxtcolor', '#000000'); INSERT INTO styles (name, value) VALUES ('maintxtfont', 'Verdana'); INSERT INTO styles (name, value) VALUES ('maintxtsize', '8'); INSERT INTO styles (name, value) VALUES ('boxbordercolor', '#306099'); INSERT INTO styles (name, value) VALUES ('boxbordersize', '1'); INSERT INTO styles (name, value) VALUES ('boxborderstyle', 'solid'); INSERT INTO styles (name, value) VALUES ('headerbgcolor', '#306099'); INSERT INTO styles (name, value) VALUES ('headertxtcolor', '#FFFFFF'); INSERT INTO styles (name, value) VALUES ('formbgcolor', '#306099'); INSERT INTO styles (name, value) VALUES ('inputbgcolor', '#FFFFFF'); INSERT INTO styles (name, value) VALUES ('inputbordercolor', '#BFBFBF'); INSERT INTO styles (name, value) VALUES ('inputbordersize', '1'); INSERT INTO styles (name, value) VALUES ('inputtxtcolor', '#000000'); INSERT INTO styles (name, value) VALUES ('row1bgcolor', '#DFDFDF'); INSERT INTO styles (name, value) VALUES ('row2bgcolor', '#EFEFEF'); INSERT INTO styles (name, value) VALUES ('headerwriting', 'Shoutboxer'); INSERT INTO styles (name, value) VALUES ('shoutbuttonvalue', 'Shout it!'); ") or die(mysql_error()); ?> [code] [/code] Quote Link to comment https://forums.phpfreaks.com/topic/75204-solved-you-have-an-error-in-your-sql-syntax-check-the-manual-that-corresponds-to-your/ Share on other sites More sharing options...
rajivgonsalves Posted October 29, 2007 Share Posted October 29, 2007 which version of mysql are you using ? Quote Link to comment https://forums.phpfreaks.com/topic/75204-solved-you-have-an-error-in-your-sql-syntax-check-the-manual-that-corresponds-to-your/#findComment-380346 Share on other sites More sharing options...
trq Posted October 29, 2007 Share Posted October 29, 2007 mysql_query() does not support multiple queries. You will need to execute them all individually. Quote Link to comment https://forums.phpfreaks.com/topic/75204-solved-you-have-an-error-in-your-sql-syntax-check-the-manual-that-corresponds-to-your/#findComment-380357 Share on other sites More sharing options...
fenway Posted October 29, 2007 Share Posted October 29, 2007 Why is it so hard to execute one query at a time/ Quote Link to comment https://forums.phpfreaks.com/topic/75204-solved-you-have-an-error-in-your-sql-syntax-check-the-manual-that-corresponds-to-your/#findComment-380381 Share on other sites More sharing options...
scarhand Posted October 29, 2007 Author Share Posted October 29, 2007 mysql_query() does not support multiple queries. You will need to execute them all individually. thanks for the tip Quote Link to comment https://forums.phpfreaks.com/topic/75204-solved-you-have-an-error-in-your-sql-syntax-check-the-manual-that-corresponds-to-your/#findComment-380386 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.