I have multiple queries which return results which I need to access in a single for loop, rather than in a while[\i] loop... I am displaying a multi-column report where some columns have far fewer results than others...
My idea was to write the result of each applicable query into an array, determine which array has the highest count, and use that value in a for loop...
Problem is, I am apparently not creating an array I can loop thorough numerically...
sample code...
I just need to better understand the array returning to PHP from the query...
My idea was to write the result of each applicable query into an array, determine which array has the highest count, and use that value in a for loop...
Problem is, I am apparently not creating an array I can loop thorough numerically...
sample code...
Code:
$query = "SELECT year, Count(year) AS year_count
FROM list_selection
GROUP BY year
ORDER BY year desc";
$result = mysql_query($query,$link);
$year_array = mysql_fetch_array($result);
for($i = 0;$i<count($year_array);$i++){
echo "$year_array[$i] <br />";
}
I just need to better understand the array returning to PHP from the query...