Re: Multiple queries in PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Per Jessen wrote:
Ashley Sheridan wrote:

I've run into a bit of a problem. I put together a query using mysql
variables in the form set @m:= 0; with the select that uses it
directly after. For any wondering, the select was using it as an
incremental value which can't be hard coded, as the value will depend
on the ordering of the results of the query itself.

The problem seems to be that while phpMyAdmin would execute this
double query perfectly well, php using mysql_query() was having
problems, as apparently it can't actually run multiple queries.

I don't know about the PHP mysql_query(), but the MySQL C API works fine
with multiple queries, it just has to be specifically enabled - the
default is one query per call. However, it looks like the multiple query option is not supported by PHP:
http://php.net/manual/en/mysqli.real-connect.php

"For security reasons the MULTI_STATEMENT flag is not supported in PHP.
If you want to execute multiple queries use the mysqli_multi_query()
function."

Same for mysql_query:

"mysql_query() sends a unique query (multiple queries are not supported)"...

--
Postgresql & php tutorials
http://www.designmagick.com/


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux