note 88377 deleted from function.mysql-fetch-array by danbrown
| From: | danbrown@php.net | Date: | Wed, 21 Jan 2009 17:23:57 +0000 |
| Subject: | note 88377 deleted from function.mysql-fetch-array by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-149605@lists.php.net to get a copy of this message | ||
Note Submitter: le_planplan at hotmail dot com
----
In response to KingIsulgard, a better one line way to put all results from the SELECT query in an
array.
<?php
// Read records
$result = mysql_query('SELECT * FROM table') or die(mysql_error());
// Put them in an array
for(; $line = mysql_fetch_assoc($result); $array[] = $line);
?>
This way, no need to delete the last line, $array is only pushed with necessary data.