I am trying to do some calls, but the 2nd query fails with command 'Commands out of sync; you can't run this command now' error.
The code looks like this:
$sql="call listReport();";
$results = mysqli_query($link,$sql);
$arr=array();
while($row=mysqli_fetch_array($results)) {
array_push($arr,$row);
}
mysqli_free_result($results);
// then I have this
// but this fails, giving t开发者_Go百科he above mentioned error
$stmt = @mysqli_prepare($link,"select ........") or die(mysqli_error($link));
@mysqli_stmt_bind_param($stmt, 's', $s);
@mysqli_stmt_execute($stmt);
@mysqli_stmt_bind_result($stmt, $s);
@mysqli_stmt_fetch($stmt);
@mysqli_stmt_close($stmt);
I actually used mysqli_free_result($results);
but doesn't worked. What do I miss?
The problem is that mysql stored procedures can return various result sets, so you should use mysqli_multiquery
精彩评论