Why I am getting the Error “Commands out of sync; you can't run this command now”

夙愿已清 提交于 2019-12-01 05:43:46

There are result set pending from the query:

mysqli_multi_query($connection,$query);

You need to use/store result before you can proceed with next query after: Since you look like you don't really care about the first result set, do this after the multi query..

do
{
    $result = mysqli_store_result($connection);
    mysqli_free_result($result);
}while(mysqli_next_result());

Another alternative is to close the connection and starts it again..

mysqli_close($connection);
$connection = mysqli_connect("localhost","username","password","tbl_msgs");

It all depends on your requirements.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!