note 102938 deleted from function.mysql-fetch-array by danbrown

From: Date: Tue, 15 Mar 2011 16:01:04 +0000
Subject: note 102938 deleted from function.mysql-fetch-array by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-177910@lists.php.net to get a copy of this message
Note Submitter: Mark Roberts (junglevip at gmail.com) ---- 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']; ?>

« previous php.notes (#177910) next »