note 60168 added to function.mysql-fetch-array
| From: | andrea at 3site dot it | Date: | Wed, 28 Dec 2005 15:51:31 +0000 |
| Subject: | note 60168 added to function.mysql-fetch-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-100859@lists.php.net to get a copy of this message | ||
alternative mysql_fetch_all
// array mysql_fetch_all(query:resource [, kind:string (default:'assoc' |
'row')])
function mysql_fetch_all($query, $kind = 'assoc') {
$result = array();
$kind = $kind === 'assoc' ? $kind : 'row';
eval('while(@$r = mysql_fetch_'.$kind.'($query)) array_push($result, $r);');
return $result;
}
// Example
$query = mysql_query($myquery) or die(mysql_error());
$result = mysql_fetch_all($query);
echo '<pre>'.print_r($result, true).'</pre>';
----
Manual Page -- http://www.php.net/manual/en/function.mysql-fetch-array.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+60168
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60168&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60168&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60168&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60168&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60168&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60168&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60168&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+60168&report=yes
Search -- http://master.php.net/manage/user-notes.php