I have this code:
while($m = $movieResult->fetch_array(MYSQLI_ASSOC)){
// stuff happens here
}
return $stuff;
It works but What I really need is to detect when the while loop doesn’t run like this example but with multiple iterations of the while loop:
if($m = $movieResult->fetch_array(MYSQLI_ASSOC)){
// stuff happens here
return $stuff;
}
else{
return false;
}
I am not sure which extension you are using (pdo/msqli/…) but i think you can see if there are any results first before starting your loop
Example: