Error only when I use PHP

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
RobertBr
Forum Newbie
Posts: 11
Joined: Fri Oct 20, 2006 1:28 pm

Error only when I use PHP

Post 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
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Error only when I use PHP

Post 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 .
There are 10 types of people in this world, those who understand binary and those who don't
RobertBr
Forum Newbie
Posts: 11
Joined: Fri Oct 20, 2006 1:28 pm

Re: Error only when I use PHP

Post by RobertBr »

Ah, that explains it, thanks for the help.

Robert
Post Reply