note 38664 added to function.mysql-fetch-array

From: Date: Fri, 02 Jan 2004 00:44:54 +0000
Subject: note 38664 added to function.mysql-fetch-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-62765@lists.php.net to get a copy of this message
I got tired of needing to do this so often, so I wrote a function to do it for me: <?php function resource2array($resource) { $num_rows = mysql_num_rows($resource); $j = 0; for($i=1; $i <= $num_rows; $i++) { $result[$j] = mysql_fetch_array($resource, MYSQL_ASSOC); $j++; } return $result; mysql_free_result($result); } ?> It really made things a lot easier. Philip Ridgeway http://www.philium.org ---- Manual Page -- http://www.php.net/manual/en/function.mysql-fetch-array.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+38664 Delete -- http://master.php.net/manage/user-notes.php?action=delete+38664&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+38664&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#62765) next »