DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Mysql_fetch_all
Absurdly simple but utilitarian function returns a numeric array of associative arrays containing an entire result set.
function mysql_fetch_all($result) {
$all = array();
while ($all[] = mysql_fetch_assoc($result)) {}
return $all;
}





Comments
Snippets Manager replied on Mon, 2007/02/26 - 7:27am
Snippets Manager replied on Mon, 2006/10/16 - 6:57pm
<?php function mysql_fetch_all($result) { $all = array(); while($thing = mysql_fetch_assoc($result)) { $all[] = $thing; } return $all; } ?>