RE: [PHP] SQL syntax error in PHP script. dunno what's wrong

From: Date: Wed, 01 Aug 2001 16:54:01 +0000
Subject: RE: [PHP] SQL syntax error in PHP script. dunno what's wrong
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-60704@lists.php.net to get a copy of this message
You will need to put single quotes around your variables in your SQL statement. Like this: $sql = "UPDATE TABLE seminar SET title='$title',speaker='$speaker',event_date='$tdate',time='$time',bldg='$bu ilding' ,rm='$room' WHERE id='$id'"; Without the quotes, SQL doesn't know that Something Amazing is supposed to go together in the same string. HTH Sam Masiello Software Quality Assurance Engineer Synacor (716) 853-1362 x289 smasiello@synacor.com -----Original Message----- From: Chris Worth [mailto:caw@bcc.louisville.edu] Sent: Wednesday, August 01, 2001 12:36 PM To: php-general@lists.php.net Subject: [PHP] SQL syntax error in PHP script. dunno what's wrong hey gang. here is my sql statement from my php script. $sql = "UPDATE TABLE seminar SET title=$title,speaker=$speaker,event_date=$tdate,time=$time,bldg=$building ,rm=$room WHERE id=$id"; it appears just like that in my code. here is the $sql string echoed to the screen to verify the variables. UPDATE TABLE seminar SET title=Something amazing,speaker=Mr. Black,event_date=2001-08-05,time=11:00:am,bldg=BCC ,rm=201 WHERE id=48 all of the variable are valid. here is my error. 1064: You have an error in your SQL syntax near 'TABLE seminar SET title=Something amazing,speaker=Mr. Black,event_date=2001-08' at line 1 I'm baffled. and I couldn't find error 1064 in the mysql manual.pdf either. any ideas. I know this is going to turn out to be something silly. thanks, chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#60704) next »