Page 1 of 1

Error only when I use PHP

Posted: Wed May 21, 2008 8:20 am
by RobertBr
I have a php page generating an SQL query to update records. The test I am using looks like this:

UPDATE main SET obvemission = 0, obvcut = 0 WHERE coinid = 190 LIMIT 1; UPDATE main SET obvemission = 0, obvcut = 0 WHERE coinid = 185 LIMIT 1; UPDATE main SET obvemission = 3, obvcut = 0 WHERE coinid = 144 LIMIT 1; UPDATE main SET obvemission = 1, obvcut = 0 WHERE coinid = 94 LIMIT 1; UPDATE main SET obvemission = 2, obvcut = 0 WHERE coinid = 89 LIMIT 1; UPDATE main SET obvemission = 2, obvcut = 0 WHERE coinid = 3 LIMIT 1;

If I take it from the webpage and paste it into PHPmyadmin it works fine, but if I try to execute the query in the php page I get an error with a please check the manual for correct syntax to use near and the second of the update queries. It is the first time I have encountered this issue with identical strings working fine when manually entered but failing if they are executed through PHP. Has anyone got any ideas why this might be happening?

Robert

Re: Error only when I use PHP

Posted: Wed May 21, 2008 8:27 am
by VladSun
mysql_query() sends an unique query (multiple queries are not supported) to the currently active database on the server that's associated with the specified link_identifier .

Re: Error only when I use PHP

Posted: Wed May 21, 2008 10:29 am
by RobertBr
Ah, that explains it, thanks for the help.

Robert