PDA

View Full Version : mySQL is throwing a fit


Hunkorama417
06-07-2001, 03:01 PM
I'm testing scripts on my local machine and the following query works fine when I substitue the variables with actual data and run it via phpMyAdmin; however, when I run the query via a PHP script is returns the following:

You have an error in your SQL syntax near '; UPDATE categories SET lastModified='991965478' WHERE id='1'' at line 1
It's rather weird because I've tried echoing the string and it appears fine w/ no errors. What's wrong w/ the following query:

mysql_query("UPDATE photos SET catID='$catID', description='$description', ratingDividen='$ratingDividen', ratingDivisor='$ratingDivisor' WHERE id='$imgID'; UPDATE categories SET lastModified='$timestamp' WHERE id='$catID'");
------------------
Andrew
http://www.digi-FX.net
andrew@digi-fx.net

bturner
06-07-2001, 03:21 PM
if your columns like catID expect numbers, don't put them in quotes. Try this:

mysql_query("UPDATE photos SET catID=$catID, description='$description', ratingDividen='$ratingDividen', ratingDivisor='$ratingDivisor' WHERE id=$imgID; UPDATE categories SET lastModified='$timestamp' WHERE id=$catID");


Assuming that id and catID are some type of integer.

hope that's what you need. - bill

Bruce
06-07-2001, 04:27 PM
Seperate the two queries into two mysql_query commands.
------------------
Bruce Guenter, FutureQuest
http://untroubled.org/

Hunkorama417
06-07-2001, 04:41 PM
Thanks both of you for your help!