Re: how to put all rows into an array

From: Date: Thu, 14 Nov 2002 01:35:23 +0000
Subject: Re: how to put all rows into an array
Groups: php.db 
Request: Send a blank email to php-db+get-23321@lists.php.net to get a copy of this message
No built-in function, but this can be handy (i have it inside a getData() function, which also lets me output data in a number of ways) HTH, Adam $sql = "SELECT * FROM ....."; $DB_RESULT = mysql_query($sql); $arrData = array(); $rowCount = 0; while ($r = mysql_fetch_array($DB_RESULT,MYSQL_ASSOC)){ foreach ($r as $key => $value){ $arrData[$rowCount++][$key] = $value; } }

« previous php.db (#23321) next »