php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7495 multiple queries.
Submitted: 2000-10-27 16:19 UTC Modified: 2000-12-07 11:59 UTC
From: maxim at maxim dot cx Assigned:
Status: Closed Package: MySQL related
PHP Version: 4.0.2 OS: RH6.2 Linux
Private report: No CVE-ID: None
 [2000-10-27 16:19 UTC] maxim at maxim dot cx
Hello Developers,

this has just come up on PHP-GENERAL mailing list and I went wild testing it.

problem:

if in shell this kind of (MySQL) query works:

UPDATE table SET column=0 WHERE id=1;UPDATE table SET column=0 WHERE id=2;UPDATE table SET column=0 WHERE id=3;UPDATE table SET column=0 WHERE id=4;UPDATE table SET column=0 WHERE id=5;

then why not to make it work in mysql_query() as well?

It gives you an error like this: 

MySQL Error: 1064: You have an error in your SQL syntax near ';UPDATE table SET column=0 WHERE id=2;UPDATE table SET column=0 WHERE id=3;U' at line 1

This could be SO useful!...
Just think about all these loops we often have to do in order to generate a similar query..  and we are still putting mysql_query() on each loop....

Thanks, 
Maxim Maletsky.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-10-27 17:23 UTC] mathieu@php.net
Why not use:

UPDATE table SET column = 0 WHERE ID IN ( 1,2,3,4,5 );

--Mathieu

 [2000-12-07 11:59 UTC] sniper@php.net
No feedback. 

 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Mon Oct 12 16:00:01 2026 UTC