note 102938 added to function.mysql-fetch-array
| From: | (junglevipatgmail.com) | Date: | Tue, 15 Mar 2011 16:00:21 +0000 |
| Subject: | note 102938 added to function.mysql-fetch-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-177909@lists.php.net to get a copy of this message | ||
The earlier post to get the full result array was too complicated, a simpler way is to copy the row
reference into the array instead of copying the array column by column...
<?php
$query="select * from table_xyz";
$result = mysql_query($query) or die(mysql_error());
$arr_table_result=mysql_fetch_full_result_array($result);
function mysql_fetch_full_result_array($result)
{
$table_result=array();
while($row = mysql_fetch_assoc($result)){
$table_result[] = $row;
}
return $table_result;
}
echo $arr_table_result[2]['id'];
?>
----
Server IP: 69.147.83.197
Probable Submitter: 109.204.12.105
----
Manual Page -- http://www.php.net/manual/en/function.mysql-fetch-array.php
Edit -- https://master.php.net/note/edit/102938
Del: integrated -- https://master.php.net/note/delete/102938/integrated
Del: useless -- https://master.php.net/note/delete/102938/useless
Del: bad code -- https://master.php.net/note/delete/102938/bad+code
Del: spam -- https://master.php.net/note/delete/102938/spam
Del: non-english -- https://master.php.net/note/delete/102938/non-english
Del: in docs -- https://master.php.net/note/delete/102938/in+docs
Del: other reasons-- https://master.php.net/note/delete/102938
Reject -- https://master.php.net/note/reject/102938
Search -- https://master.php.net/manage/user-notes.php