If I am fetching data from a MySQL database and using a while loop to iterate through the data how would I add each one to array?
$result = mysql_query(\"SEL
Build an array up as you iterate with the while loop.
while
$result = mysql_query("SELECT * FROM `Departments`"); $results = array(); while($row = mysql_fetch_assoc($result)) { $results[] = $row; }
Alternatively, if you used PDO, you could do this automatically.