Error documentation mentioned in title
If you get Teams are not synchronized; you cannot run this command now in your client code, you are calling client functions in the wrong order.
This can happen, for example, if you use mysql_use_result () and try a new query before you call mysql_free_result (). This can also happen if you try to execute two queries that return data without calling mysql_use_result () or mysql_store_result () between them.
From here: http://dev.mysql.com/doc/refman/5.0/en/commands-out-of-sync.html
But in the first query, I am not retrieving data from the mysql database, I am just pasting. And in the second query, I get data from the database.
Here is my code
$connection = mysqli_connect("localhost","username","password","tbl_msgs"); if(mysqli_connect_errno($connection)) { die("Failed to connect to MySQL: " . mysqli_connect_error()); } $query = "INSERT INTO users (total_comments, total_views) VALUES ({$total_comments}, {$total_views});"; $query .= "INSERT INTO msgs (notifications) VALUES ({$notifications})"; mysqli_multi_query($connection,$query);
Up to this step, everything is fine. But when I execute the following query, it gives an error
$select_query = "SELECT * FROM msgs WHERE msg_id = {$msg_id}"; $result_set = mysqli_query($connection,$select_query); if(!$result_set) { die(mysqli_error($connection)); }
Here he gives the error Commands out of sync; you can't run this command now Commands out of sync; you can't run this command now . I can not understand this situation.
Note. There is some problem in the request, I executed the same request directly in PHPMyAdmin and it works fine.