I've got this query:
mysql_select_db($database_links, $links);
$businesses = mysql_query($query_businesses, $links) or die(mysql_error());
$row_businesses = mysql_fetch_assoc($businesses);
$totalRows_businesses = mysql_num_rows($businesses);
which returns a number of records (the query string is specified earlier in the code)... and it works perfectly (as it should!) but I want to add all the results of the query to another array so that I can filter them based on a value in the mysql table.
I know I can do this with another, more specific, MySQL query, but I thought this way would be more efficient (correct me if I'm wrong)
So i used this foreach loop to add the results to the associative array $featured_array
foreach ($row_businesses as $col => $val) {
$featured_array = array($col => $val);
}
...except that it doesnt work! I wrote it myself and I'm new to this so that's probably why its not working but I'd appreciate a pointed in the right direction!
Also, am I going about this correctly? Should i simply use another query? Or is there a third, better way to achieving what I need.
Thanks in advance!