ckrudelux Posted October 22, 2011 Share Posted October 22, 2011 <?php$rows = array();$query = mysql_query("SQL CODE");while($row = mysql_fetch_assoc($query)){$rows[] = row;}return $rows;?> Is where a function for this which returns all rows instead of one at the time so I don't need to use a loop? Link to comment Share on other sites More sharing options...
Ingolme Posted October 22, 2011 Share Posted October 22, 2011 Not as far as I know. Probably not, but you can always look through the PHP manual. Link to comment Share on other sites More sharing options...
ckrudelux Posted October 22, 2011 Author Share Posted October 22, 2011 Not as far as I know. Probably not, but you can always look through the PHP manual.Couldn't find anything whats why I asked here Link to comment Share on other sites More sharing options...
Ingolme Posted October 22, 2011 Share Posted October 22, 2011 Most likely, if something's not in the manual, it doesn't exist. You can make your own custom function, though. function mysql_fetch_all($q) { $a = array(); while($b= mysql_fetch_assoc($q)){ $a[] = $b; } return $a;} Link to comment Share on other sites More sharing options...
Don E Posted October 22, 2011 Share Posted October 22, 2011 If I understand correctly with what you're asking, it would depend on if you're getting many rows or just one row. If you're getting many rows, you still have to use the while loop. Here's info on mysql_fetch_assoc: http://us.php.net/manual/en/function.mysql-fetch-assoc.php Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.