How does mysql execute multiple SQL statements at a time?
Source: Internet
Author: User
How does mysql execute multiple SQL statements at a time? & Lt ;? Php $ SQL = & quot; SELECT @ a: = idFROMcsdnorderbyidasclimit30, 1; SELECT @ B: = idFROMcsdnorderbyidasclimit how does mysql execute multiple SQL statements at a time?
$ SQL ="
SELECT @ a: = id FROM csdn order by id asc limit 30,1;
SELECT @ B: = id FROM csdn order by id asc limit 60, 1;
SELECT * from csdn where id> @ a and id <@ B;
";
$ Result = mysql_query ($ SQL );
While ($ rs = @ mysql_fetch_array ($ result, MYSQL_ASSOC) {// empty record
Echo"
". $ Rs ['name']; } ?>
An empty record is returned. Put the content in $ SQL in phpmyadmin and execute it correctly. Therefore, the SQL statement should be correct. it is estimated that there is a problem with the connection method. How can I write it to display it? thank you!
------ Solution -------------------- Mysql_query does not support running multiple SQL statements at the same time. You need to separate the marker
Mysql_query ("SELECT @ a: = id FROM csdn order by id asc limit 30,1 "); Mysql_query ("SELECT @ B: = id FROM csdn order by id asc limit 60, 1 "); Mysql_query ("SELECT * from csdn where id> @ a and id <@ B ");
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.