[PHP] SQL Error
I'm having some troubles. I have an install script which runs a lot of SQL statements to create tables then insert info into them. One of them is an emoticons table. Here's the error I'm getting: You have an error in your SQL syntax near '; INSERT INTO c_emotes VALUES \(':\)', 'emotes/smile.gif'\); INSERT INTO c_emo' at line 4 or, if I change my code a little, it's this: You have an error in your SQL syntax near '; INSERT INTO c_emotes VALUES \(':)', 'emotes/smile.gif'\); INSERT INTO c_emo' at line 4 Here's my code which inserts the information: INSERT INTO c_emotes VALUES (':)', 'emotes/smile.gif'); // I also have tried placing a \ infront of the )...no luckINSERT INTO c_emotes VALUES (';)', 'emotes/wink.gif');INSERT INTO c_emotes VALUES (':(', 'emotes/sad.gif');INSERT INTO c_emotes VALUES (':P', 'emotes/tounge.gif');INSERT INTO c_emotes VALUES (':|', 'emotes/blank.gif');INSERT INTO c_emotes VALUES (':-|', 'emotes/blank.gif');INSERT INTO c_emotes VALUES (':-)', 'emotes/smile.gif');INSERT INTO c_emotes VALUES (';-)', 'emotes/wink.gif');INSERT INTO c_emotes VALUES (':-P', 'emotes/tounge.gif');INSERT INTO c_emotes VALUES (':-(', 'emotes/sad.gif'); Anyone see the problem?? Thanks,Stephen Cratonhttp://www.melchior.us "What is a dreamer that cannot persevere?" -- http://www.melchior.us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL Error
I just tried this in MySQL and it inserted no problem INSERT INTO c_emotes VALUES (6, ':-)'); Mike *** REPLY SEPARATOR *** On 30/12/2002 at 7:14 PM Stephen wrote: I'm having some troubles. I have an install script which runs a lot of SQL statements to create tables then insert info into them. One of them is an emoticons table. Here's the error I'm getting: You have an error in your SQL syntax near '; INSERT INTO c_emotes VALUES \(':\)', 'emotes/smile.gif'\); INSERT INTO c_emo' at line 4 or, if I change my code a little, it's this: You have an error in your SQL syntax near '; INSERT INTO c_emotes VALUES \(':)', 'emotes/smile.gif'\); INSERT INTO c_emo' at line 4 Here's my code which inserts the information: INSERT INTO c_emotes VALUES (':)', 'emotes/smile.gif'); // I also have tried placing a \ infront of the )...no luck INSERT INTO c_emotes VALUES (';)', 'emotes/wink.gif'); INSERT INTO c_emotes VALUES (':(', 'emotes/sad.gif'); INSERT INTO c_emotes VALUES (':P', 'emotes/tounge.gif'); INSERT INTO c_emotes VALUES (':|', 'emotes/blank.gif'); INSERT INTO c_emotes VALUES (':-|', 'emotes/blank.gif'); INSERT INTO c_emotes VALUES (':-)', 'emotes/smile.gif'); INSERT INTO c_emotes VALUES (';-)', 'emotes/wink.gif'); INSERT INTO c_emotes VALUES (':-P', 'emotes/tounge.gif'); INSERT INTO c_emotes VALUES (':-(', 'emotes/sad.gif'); Anyone see the problem?? Thanks, Stephen Craton http://www.melchior.us What is a dreamer that cannot persevere? -- http://www.melchior.us
RE: [PHP] SQL Error
I don't think there's anything wrong with the queries themselves. Are you trying to run them all at once? You're getting an error because MySQL is reaching a semi-colon somewhere and that's causing a parse error... Show how you're trying to run all of these queries. Bottom line, you must do them one at a time with mysql_query, or run them through the command line in a file. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -Original Message- From: Stephen [mailto:[EMAIL PROTECTED]] Sent: Monday, December 30, 2002 7:15 PM To: PHP List Subject: [PHP] SQL Error I'm having some troubles. I have an install script which runs a lot of SQL statements to create tables then insert info into them. One of them is an emoticons table. Here's the error I'm getting: You have an error in your SQL syntax near '; INSERT INTO c_emotes VALUES \(':\)', 'emotes/smile.gif'\); INSERT INTO c_emo' at line 4 or, if I change my code a little, it's this: You have an error in your SQL syntax near '; INSERT INTO c_emotes VALUES \(':)', 'emotes/smile.gif'\); INSERT INTO c_emo' at line 4 Here's my code which inserts the information: INSERT INTO c_emotes VALUES (':)', 'emotes/smile.gif'); // I also have tried placing a \ infront of the )...no luck INSERT INTO c_emotes VALUES (';)', 'emotes/wink.gif'); INSERT INTO c_emotes VALUES (':(', 'emotes/sad.gif'); INSERT INTO c_emotes VALUES (':P', 'emotes/tounge.gif'); INSERT INTO c_emotes VALUES (':|', 'emotes/blank.gif'); INSERT INTO c_emotes VALUES (':-|', 'emotes/blank.gif'); INSERT INTO c_emotes VALUES (':-)', 'emotes/smile.gif'); INSERT INTO c_emotes VALUES (';-)', 'emotes/wink.gif'); INSERT INTO c_emotes VALUES (':-P', 'emotes/tounge.gif'); INSERT INTO c_emotes VALUES (':-(', 'emotes/sad.gif'); Anyone see the problem?? Thanks, Stephen Craton http://www.melchior.us What is a dreamer that cannot persevere? -- http://www.melchior.us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sql error
I know this is the wrong mailinglist, but i don't want to subscribe to a second one for one random question. when trying to enter this into my db: DROP TABLE IF EXISTS dates; CREATE TABLE dates ( id int(10) unsigned NOT NULL auto_increment, date varchar(50) NOT NULL default '', at varchar(50) NOT NULL default '', where varchar(255) NOT NULL default '', with varchar(255) NOT NULL default '', whereURL varchar(100) NOT NULL default '', info varchar(255) NOT NULL default '', PRIMARY KEY (id) ) TYPE=MyISAM; (this is generated by phpMyAdmin) i get this error: ERROR 1064 at line 18: You have an error in your SQL syntax near 'where varchar(255) NOT NULL default '', with varchar(255) NOT NULL default '',' at line 5 where's the error? i don't see anything wrong.. TIA, Jule Jule Slootbeek [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sql error
where is a reserved keyword in SQL--try changing the name of that column to something else. Marco --- php|architect -- The Monthly Magazine For PHP Professionals Visit us on the web at http://www.phparch.com! On Tue, 5 Nov 2002, Jule Slootbeek wrote: I know this is the wrong mailinglist, but i don't want to subscribe to a second one for one random question. when trying to enter this into my db: DROP TABLE IF EXISTS dates; CREATE TABLE dates ( id int(10) unsigned NOT NULL auto_increment, date varchar(50) NOT NULL default '', at varchar(50) NOT NULL default '', where varchar(255) NOT NULL default '', with varchar(255) NOT NULL default '', whereURL varchar(100) NOT NULL default '', info varchar(255) NOT NULL default '', PRIMARY KEY (id) ) TYPE=MyISAM; (this is generated by phpMyAdmin) i get this error: ERROR 1064 at line 18: You have an error in your SQL syntax near 'where varchar(255) NOT NULL default '', with varchar(255) NOT NULL default '',' at line 5 where's the error? i don't see anything wrong.. TIA, Jule Jule Slootbeek [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sql error
Ah i see, but then why will phpMyAdmin let me use it? it works fine on my local db with these names, but on my remote server it refuses to create the table. Jule On Tuesday, Nov 5, 2002, at 21:47 US/Eastern, Marco Tabini wrote: where is a reserved keyword in SQL--try changing the name of that column to something else. Marco --- php|architect -- The Monthly Magazine For PHP Professionals Visit us on the web at http://www.phparch.com! On Tue, 5 Nov 2002, Jule Slootbeek wrote: I know this is the wrong mailinglist, but i don't want to subscribe to a second one for one random question. when trying to enter this into my db: DROP TABLE IF EXISTS dates; CREATE TABLE dates ( id int(10) unsigned NOT NULL auto_increment, date varchar(50) NOT NULL default '', at varchar(50) NOT NULL default '', where varchar(255) NOT NULL default '', with varchar(255) NOT NULL default '', whereURL varchar(100) NOT NULL default '', info varchar(255) NOT NULL default '', PRIMARY KEY (id) ) TYPE=MyISAM; (this is generated by phpMyAdmin) i get this error: ERROR 1064 at line 18: You have an error in your SQL syntax near 'where varchar(255) NOT NULL default '', with varchar(255) NOT NULL default '',' at line 5 where's the error? i don't see anything wrong.. TIA, Jule Jule Slootbeek [EMAIL PROTECTED] Jule Slootbeek [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sql error
I'm not entirely sure... different configurations perhaps? Have you verified that that's indeed the problem? Marco --- php|architect -- The Monthly Magazine For PHP Professionals Visit us on the web at http://www.phparch.com! On Tue, 5 Nov 2002, Jule Slootbeek wrote: Ah i see, but then why will phpMyAdmin let me use it? it works fine on my local db with these names, but on my remote server it refuses to create the table. Jule On Tuesday, Nov 5, 2002, at 21:47 US/Eastern, Marco Tabini wrote: where is a reserved keyword in SQL--try changing the name of that column to something else. Marco --- php|architect -- The Monthly Magazine For PHP Professionals Visit us on the web at http://www.phparch.com! On Tue, 5 Nov 2002, Jule Slootbeek wrote: I know this is the wrong mailinglist, but i don't want to subscribe to a second one for one random question. when trying to enter this into my db: DROP TABLE IF EXISTS dates; CREATE TABLE dates ( id int(10) unsigned NOT NULL auto_increment, date varchar(50) NOT NULL default '', at varchar(50) NOT NULL default '', where varchar(255) NOT NULL default '', with varchar(255) NOT NULL default '', whereURL varchar(100) NOT NULL default '', info varchar(255) NOT NULL default '', PRIMARY KEY (id) ) TYPE=MyISAM; (this is generated by phpMyAdmin) i get this error: ERROR 1064 at line 18: You have an error in your SQL syntax near 'where varchar(255) NOT NULL default '', with varchar(255) NOT NULL default '',' at line 5 where's the error? i don't see anything wrong.. TIA, Jule Jule Slootbeek [EMAIL PROTECTED] Jule Slootbeek [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] sql error
PHPMyAdmin may put tick marks around the name, which will get rid of the error. `where` varchar(255) not null ... ---John Holmes... -Original Message- From: Jule Slootbeek [mailto:jslootbeek;clarku.edu] Sent: Tuesday, November 05, 2002 9:43 PM To: Marco Tabini Cc: [EMAIL PROTECTED] Subject: Re: [PHP] sql error Ah i see, but then why will phpMyAdmin let me use it? it works fine on my local db with these names, but on my remote server it refuses to create the table. Jule On Tuesday, Nov 5, 2002, at 21:47 US/Eastern, Marco Tabini wrote: where is a reserved keyword in SQL--try changing the name of that column to something else. Marco --- php|architect -- The Monthly Magazine For PHP Professionals Visit us on the web at http://www.phparch.com! On Tue, 5 Nov 2002, Jule Slootbeek wrote: I know this is the wrong mailinglist, but i don't want to subscribe to a second one for one random question. when trying to enter this into my db: DROP TABLE IF EXISTS dates; CREATE TABLE dates ( id int(10) unsigned NOT NULL auto_increment, date varchar(50) NOT NULL default '', at varchar(50) NOT NULL default '', where varchar(255) NOT NULL default '', with varchar(255) NOT NULL default '', whereURL varchar(100) NOT NULL default '', info varchar(255) NOT NULL default '', PRIMARY KEY (id) ) TYPE=MyISAM; (this is generated by phpMyAdmin) i get this error: ERROR 1064 at line 18: You have an error in your SQL syntax near 'where varchar(255) NOT NULL default '', with varchar(255) NOT NULL default '',' at line 5 where's the error? i don't see anything wrong.. TIA, Jule Jule Slootbeek [EMAIL PROTECTED] Jule Slootbeek [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sql error
apparently 'where' and 'with' are keywords in Java, i've changed them and now it works fine. thanks! Jule On Tuesday, Nov 5, 2002, at 21:53 US/Eastern, Marco Tabini wrote: I'm not entirely sure... different configurations perhaps? Have you verified that that's indeed the problem? Marco --- php|architect -- The Monthly Magazine For PHP Professionals Visit us on the web at http://www.phparch.com! On Tue, 5 Nov 2002, Jule Slootbeek wrote: Ah i see, but then why will phpMyAdmin let me use it? it works fine on my local db with these names, but on my remote server it refuses to create the table. Jule On Tuesday, Nov 5, 2002, at 21:47 US/Eastern, Marco Tabini wrote: where is a reserved keyword in SQL--try changing the name of that column to something else. Marco --- php|architect -- The Monthly Magazine For PHP Professionals Visit us on the web at http://www.phparch.com! On Tue, 5 Nov 2002, Jule Slootbeek wrote: I know this is the wrong mailinglist, but i don't want to subscribe to a second one for one random question. when trying to enter this into my db: DROP TABLE IF EXISTS dates; CREATE TABLE dates ( id int(10) unsigned NOT NULL auto_increment, date varchar(50) NOT NULL default '', at varchar(50) NOT NULL default '', where varchar(255) NOT NULL default '', with varchar(255) NOT NULL default '', whereURL varchar(100) NOT NULL default '', info varchar(255) NOT NULL default '', PRIMARY KEY (id) ) TYPE=MyISAM; (this is generated by phpMyAdmin) i get this error: ERROR 1064 at line 18: You have an error in your SQL syntax near 'where varchar(255) NOT NULL default '', with varchar(255) NOT NULL default '',' at line 5 where's the error? i don't see anything wrong.. TIA, Jule Jule Slootbeek [EMAIL PROTECTED] Jule Slootbeek [EMAIL PROTECTED] Jule Slootbeek [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sql error
possible, but wouldn't phpMyAdmin export the name with the tick marks?? CREATE TABLE foo (`where` varchar(255) NOT NULL); Jule On Tuesday, Nov 5, 2002, at 21:51 US/Eastern, John W. Holmes wrote: PHPMyAdmin may put tick marks around the name, which will get rid of the error. `where` varchar(255) not null ... ---John Holmes... -Original Message- From: Jule Slootbeek [mailto:jslootbeek;clarku.edu] Sent: Tuesday, November 05, 2002 9:43 PM To: Marco Tabini Cc: [EMAIL PROTECTED] Subject: Re: [PHP] sql error Ah i see, but then why will phpMyAdmin let me use it? it works fine on my local db with these names, but on my remote server it refuses to create the table. Jule On Tuesday, Nov 5, 2002, at 21:47 US/Eastern, Marco Tabini wrote: where is a reserved keyword in SQL--try changing the name of that column to something else. Marco --- php|architect -- The Monthly Magazine For PHP Professionals Visit us on the web at http://www.phparch.com! On Tue, 5 Nov 2002, Jule Slootbeek wrote: I know this is the wrong mailinglist, but i don't want to subscribe to a second one for one random question. when trying to enter this into my db: DROP TABLE IF EXISTS dates; CREATE TABLE dates ( id int(10) unsigned NOT NULL auto_increment, date varchar(50) NOT NULL default '', at varchar(50) NOT NULL default '', where varchar(255) NOT NULL default '', with varchar(255) NOT NULL default '', whereURL varchar(100) NOT NULL default '', info varchar(255) NOT NULL default '', PRIMARY KEY (id) ) TYPE=MyISAM; (this is generated by phpMyAdmin) i get this error: ERROR 1064 at line 18: You have an error in your SQL syntax near 'where varchar(255) NOT NULL default '', with varchar(255) NOT NULL default '',' at line 5 where's the error? i don't see anything wrong.. TIA, Jule Jule Slootbeek [EMAIL PROTECTED] Jule Slootbeek [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Jule Slootbeek [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sql error
did I say Java? oops, i meant SQLlearning Java in my comp sci class..(= forgive me. Jule On Tuesday, Nov 5, 2002, at 21:54 US/Eastern, Martin Towell wrote: where is a java keyword ? have you got an example ? It's been _ages_ since I've done any code in java :( -Original Message- From: Jule Slootbeek [mailto:jslootbeek;clarku.edu] Sent: Wednesday, November 06, 2002 1:52 PM To: Marco Tabini Cc: [EMAIL PROTECTED] Subject: Re: [PHP] sql error apparently 'where' and 'with' are keywords in Java, i've changed them and now it works fine. thanks! Jule On Tuesday, Nov 5, 2002, at 21:53 US/Eastern, Marco Tabini wrote: I'm not entirely sure... different configurations perhaps? Have you verified that that's indeed the problem? Marco --- php|architect -- The Monthly Magazine For PHP Professionals Visit us on the web at http://www.phparch.com! On Tue, 5 Nov 2002, Jule Slootbeek wrote: Ah i see, but then why will phpMyAdmin let me use it? it works fine on my local db with these names, but on my remote server it refuses to create the table. Jule On Tuesday, Nov 5, 2002, at 21:47 US/Eastern, Marco Tabini wrote: where is a reserved keyword in SQL--try changing the name of that column to something else. Marco --- php|architect -- The Monthly Magazine For PHP Professionals Visit us on the web at http://www.phparch.com! On Tue, 5 Nov 2002, Jule Slootbeek wrote: I know this is the wrong mailinglist, but i don't want to subscribe to a second one for one random question. when trying to enter this into my db: DROP TABLE IF EXISTS dates; CREATE TABLE dates ( id int(10) unsigned NOT NULL auto_increment, date varchar(50) NOT NULL default '', at varchar(50) NOT NULL default '', where varchar(255) NOT NULL default '', with varchar(255) NOT NULL default '', whereURL varchar(100) NOT NULL default '', info varchar(255) NOT NULL default '', PRIMARY KEY (id) ) TYPE=MyISAM; (this is generated by phpMyAdmin) i get this error: ERROR 1064 at line 18: You have an error in your SQL syntax near 'where varchar(255) NOT NULL default '', with varchar(255) NOT NULL default '',' at line 5 where's the error? i don't see anything wrong.. TIA, Jule Jule Slootbeek [EMAIL PROTECTED] Jule Slootbeek [EMAIL PROTECTED] Jule Slootbeek [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Jule Slootbeek [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php