How to build array from select statement?
Posted: Sat Mar 31, 2007 2:51 pm
I'm using a select statement that is returning two rows. I want to put those rows into an array, but my code only creates the current array that is in the loop and when it goes through the loop the second time the first array is replaced in the $array variable by the second row. How can I store all rows into an array?
Thanks.
Code: Select all
$result = mysql_query("SELECT stuff
FROM tables
WHERE this = that");
while ($row = mysql_fetch_array($result)) {
$array = $row;
}Thanks.