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

Snippets has posted 5883 posts at DZone. View Full User Profile

Mysql_fetch_all

04.10.2012
| 8477 views |
  • submit to reddit
        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;
}