f you get Commands out of sync; you can't run this command now
in your client code, you are calling client functions in the wrong order.
This can happen, for example, if you are using mysql_use_result()
and try to execute a new query before you have called mysql_free_result()
. It can also happen if you try to execute two queries that return data without calling mysql_use_result()
or mysql_store_result()
in between.
如果查询有结果集,但是却没有在查询后面释放掉,那么后面的查询就执行不了。
如果调用了存储过程,返回的多个结果集,那么需要这样:
do
{
result = mysql_store_result( mysql );
if (result ) mysql_free_result(result);
}while( !mysql_next_result( mysql ) );