Uploaded August 2020 | Updated November 2026, 5 hours ago
FIX MySQLi ERROR: Commands out of sync; you can't run this command now (after mysqli_multi_query)
I could not run consecutive mysqli_multi_query without getting the following error after the first run:
Commands out of sync; you can't run this command now
After trying a bunch of suggestions, I finally found that if the following statement was run between the mysqli_multi_query (and after the last one) I no longer had the error:
while(mysqli_next_result($database_connection)){;}
Error, MySQL, MySQLi, commands, sync, can't, run, now, mysqli_multi_query,
mysqli_next_result, $link, $con, $connection, PHP
FIX MySQLi ERROR: Commands out of sync; you can't run this command now (after mysqli_multi_query)
I could not run consecutive mysqli_multi_query without getting the following error after the first run:
Commands out of sync; you can't run this command now
After trying a bunch of suggestions, I finally found that if the following statement was run between the mysqli_multi_query (and after the last one) I no longer had the error:
while(mysqli_next_result($database_connection)){;}
Error, MySQL, MySQLi, commands, sync, can't, run, now, mysqli_multi_query,
mysqli_next_result, $link, $con, $connection, PHP





![PHP - How to Get the Root Domain Name from the URL of a Page (HOST)
Get the free source code at HelpVideoGuru.com: http://helpvideoguru.com/samples/php/get_root_domain/index.html
There are times when you have multiple domains pointing to the same host, and you require a script to detect which domain the visitor is using.
This function returns the root domain via PHP, which you can use to redirect the visitor to another page or folder, to customize which ads are displayed, determine which database to connect to, etc.
The script makes use of the $_SERVER[HTTP_HOST] variable, as well as the regular expression function ereg_replace, and the PHP function parse_url. PHP - How to Get the Root Domain Name from the URL of a Page (HOST)](https://i.ytimg.com/vi/zx4XqoyZ9A4/mqdefault.jpg)