php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #40167 mysql_query: include a notice that only 1 command can be sent at a time
Submitted: 2007-01-19 14:28 UTC Modified: 2007-01-19 20:00 UTC
From: burg1 at gmx dot net Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: burg1 at gmx dot net
New email:
PHP Version: OS:

 

 [2007-01-19 14:28 UTC] burg1 at gmx dot net
Description:
------------
As far as I can see, the following command is not possible:
mysql_query("INSERT INTO (name) VALUES ('Lucy'); INSERT INTO (ids) VALUES (1);");

My suggestion: Please include a notice to the mysql_query-function that only one MySQL-command can be sent at a time.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-19 15:07 UTC] bjori@php.net
Where does it imply that you can run multiple queries at 
once in our docs?

And FYI: AFAIK only MySQL 3.x disliked it, but MySQL 4.1+ 
allows it.
 [2007-01-19 15:14 UTC] burg1 at gmx dot net
My (naive) assumption was that you can take any valid MySQL-command, wrap mysql_query() around it, and there you go ;-)

All I'm asking about is to include a short note to prevent others from trying back and forth, thereby wasting an hour, as I just was......

MySQL: I have MySQL 5.0, and although the command worked perfectly fine when entered directly into phpMyAdmins's SQL-window, it didn't work through mysql_query.
 [2007-01-19 15:19 UTC] bjori@php.net
ext/mysql is meant for mysql3
ext/mysqli is meant for mysql4.1+

You are looking for http://php.net/mysqli_multi_query

 [2007-01-19 15:32 UTC] burg1 at gmx dot net
Yes - thank you!! :-)
(But I have PHP 4 :-(

Anyway - please include a notice to mysql_query, e.g.:
"Note: Multiple queries separated by semicolons (e.g. INSERT INTO (name) VALUES ('Lucy'); INSERT INTO (ids)
VALUES (1);) are only possible through mysqli_multi_query (PHP 5)."
 [2007-01-19 20:00 UTC] nlopess@php.net
OK. I've added a little note to the docs (should be on-line in a few days).
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 07 16:01:35 2025 UTC