note 48764 deleted from function.mysql-fetch-array by philip
| From: | philip@php.net | Date: | Fri, 25 Mar 2005 19:55:56 +0000 |
| Subject: | note 48764 deleted from function.mysql-fetch-array by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-86991@lists.php.net to get a copy of this message | ||
Note Submitter: himself at zhwau dot net
----
Browsing through the documentation I noticed there isn't a function to return the whole of the
table when you query a MySQL database. Therefore, i added a function to address this redundancy:
<?php
function mysql_table($query, $db) {
$a = mysql_query($query, $db);
$c = array();
while($b = mysql_fetch_row($a)) {
$c[] = $b;
}
return $c;
}
?>
This function usually takes a SELECT query and returns a multidimensional array, its first dimension
being the row number of the result and the second dimension the associated values of the queried
table.
Hope this helps anyone else too.