MySQL: Commands out of sync; you can't run this command now
- The connection should mark as flag CLIENT_MULTI_STATEMENTS if the calling procedure will return the dataset;
- Fetch all results and free them if calling the procedure multi-times.
do {
MYSQL_RES* res = mysql_store_result(mysql_);
mysql_free_result(res);
} while ((0 == mysql_next_result(mysql_)));
Refer: phpMyAdmin PRs