/ Published in: PHP
Simple but utilitarian function returns a numeric array of associative arrays containing an entire result set.
Expand |
Embed | Plain Text
<?php /* 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) { return $all; } ?>
Comments
Subscribe to comments
You need to login to post a comment.

the while loop would be better written as
otherwise, the last (false) fetch will give you 1 extra array item
An even better version that I've been using for a few years:
function mysqlfetchall($res) { $a = array(); while($a[] = mysqlfetchassoc($res)); array_pop($a); return $a; }
also deals with the one-off issue