This code is working correctly on my localhost (Xampp, PHP 5.4) but when I deploy this code on a server (Wamp, PHP 5.5), it's firing this error for $mysqli->multiquery()
.
Here is my code:
if($mysqli->multi_query("CALL `wc_new_tyre_article` ('$season','$dimB','$dimQ','$dimD','$com_id','$adr_id')")){
do{
if($result = $mysqli->store_result( )){
while($row = $result->fetch_object( )){
if(isset($row->empty))
break 1;
$articleId = $row->ART_ID;
$ggrId = $row->GGR_ID;
$articles[] = $row;
}
$result->close();
}
}while($mysqli->next_result() && $mysqli->more_results());
for($index = 0;$index<count($articles);$index++){
$articleId = $articles[$index]->ART_ID;
$ggrId = $articles[$index]->GGR_ID;
if(!empty($articleId) && !empty($ggrId)){
if($stk_results = $mysqli->query("CALL `wc_get_stock` ('$articleId','$ggrId','$com_id')")){
while($rows = mysqli_fetch_object($stk_results)){
$articles[$index]->STOCK = $rows;
while($mysqli->next_result()){
if($l_result = $mysqli->store_result())
$l_result->free();
}
}
}
}
}
return $articles;
As per above code first I am calling wc_new_tyre_article
which return multiple result set. Using this results I call another SP wc_get_stock
to fetch another results.
I have tried all solutions which are was available here but none of them are working.
I have tried error_reporting(E_ALL ^ E_STRICT)
.
If you are doing a CALL query, does that mean you have just finished doing a CREATE PROCEDURE query? Can we see this portion? Is there something out of sync before we get to the start of your multi_query? Did you check $mysqli->error before running multi_query?
I don't have any experience with CALL queries, but I read somewhere that 1 CALL query can return >1 results sets. How many result sets is yours returning? Do you need to pull next_result and more_results out of the do while condition to properly handle >1 result set?