kemnet Posted May 21, 2012 Share Posted May 21, 2012 Hello, i have a query that returns multiple results but in my php query it only returns the first result...ive been checking google on while loops but still havent gotten it to work...would love if someone could look at it...thanks // while ($result= mysql_fetch_array($stmt)){ while ($stmt->fetch()) { break; // $stmt->close(); // Return unlock code, encoded with JSON $result[] = array( "l_name"=>$l_name, "f_name"=>$f_name, "birth"=>$birth, "expires"=>$expires, ); sendResponse(200, json_encode($result)); return true; sendResponse(400, 'Invalid request'); return false Quote Link to comment https://forums.phpfreaks.com/topic/262862-help-with-while-fetch-loop/ Share on other sites More sharing options...
PFMaBiSmAd Posted May 21, 2012 Share Posted May 21, 2012 If you are using mysqli prepared statements, there's an example in the manual that shows how to loop over the result set - http://php.net/manual/en/mysqli-stmt.fetch.php Quote Link to comment https://forums.phpfreaks.com/topic/262862-help-with-while-fetch-loop/#findComment-1347263 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.