note 37737 deleted from function.mysql-fetch-array by philip
| From: | philip@php.net | Date: | Sun, 08 Aug 2004 16:43:49 +0000 |
| Subject: | note 37737 deleted from function.mysql-fetch-array by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-74246@lists.php.net to get a copy of this message | ||
Note Submitter: brendan [at] unsharpmask [dot] com
----
Often I need to store the entire result as an array, not just a single row... so I wrote this simple
function. It optionally accepts a row name to index by.
<?php
function mysql_fetch_array_r($result, $index_row = "", $fetch = MYSQL_ASSOC){
while ($row = mysql_fetch_array($result,$fetch)){
$whole_result[$row[$index_row]] = $row;
}
return $whole_result;
}
?>