简体   繁体   English

PHP 5.3:mysqli_multi_query和“命令不同步”错误

[英]PHP 5.3: mysqli_multi_query and “commands out of sync” errors

When I use mysqli_multi_query() with a mass INSERT query, then after the query has run do another query using mysqli_query('SELECT...'), I get "commands out of sync" errors. 当我将mysqli_multi_query()与大量INSERT查询一起使用时,在查询运行后,使用mysqli_query('SELECT ...')进行另一个查询,我得到“命令不同步”错误。 Does anyone know why this happens? 有谁知道为什么会这样?

You've to call mysqli_use_result (or mysqli_store_result ) after a mysqli_multi_query() call. 您必须在mysqli_multi_query()调用之后调用mysqli_use_result (或mysqli_store_result )。

Lower level documentation about this error: http://dev.mysql.com/doc/refman/5.1/en/commands-out-of-sync.html 有关此错误的底层文档: http : //dev.mysql.com/doc/refman/5.1/en/commands-out-of-sync.html

Use mysqli_next_result($db) , after freeing the result set if any . 释放结果集(如有)后,使用mysqli_next_result($ db)。 This alone would fix the out of sync issues. 仅此一项就可以解决不同步问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM