The docs for multi_query say:
Returns FALSE if the first statement failed. To retrieve subsequent errors from other statements you have to call mysqli
Bill Karwin's answer doesn't look very eloquent to me. It seems strange to write separate conditional breaks when the do while loop is already setup to handle breakpoints.
I haven't tested the following snippet, but you should be able to access the necessary results and errors from it:
$queries["CURRENT_USER"]="SELECT CURRENT_USER()";
$queries["CITY_NAME"]="SELECT Name FROM City ORDER BY ID LIMIT 20, 5";
if(mysqli_multi_query($mysqli,implode(';',$queries))){
do{
list($current_table,$current_query)=each($queries);
if($current_table!="CURRENT_USER"){
printf("-----------------\n");
}
if($result=mysqli_store_result($mysqli)){
if(mysqli_num_rows($result)<1){
echo "Logic Error @ $current_table Query
$current_query
";
}else{
while($row=mysqli_fetch_row($result)){
printf("%s\n",$row[0]);
}
}
mysqli_free_result($result);
}
} while(mysqli_more_results($mysqli) && mysqli_next_result($mysqli));
}else{
list($current_table,$current_query)=each($queries);
}
if($error=mysqli_error($mysqli)){
echo "Syntax Error @ $current_table Query
$current_query
Error: $error
";
}