Re: how to put all rows into an array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;
 }
}



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux