I'm basically trying to simply select from a table into an array...and it's not working correctly.
I have the following query
$graph = mysql_query("SELECT MONTHNAME(dateadded) MONTH, COUNT(*) COUNT
FROM products
WHERE ((YEAR(dateadded)=2012) && (site_url = '$_GET[site_url_graph]'))
GROUP BY MONTH(dateadded)",$db);
and I need to the results to be in an array like this (can be long or short month name thats not the issue):
$data = array(
'Jan' => 12,
'Feb' => 25,
'Mar' => 0,
'Apr' => 7,
'May' => 80,
'Jun' => 67,
'Jul' => 45,
'Aug' => 66,
'Sep' => 23,
'Oct' => 23,
'Nov' => 78,
'Dec' => 6
);
I'm trying this but getting message that not an array:
$data = array();
while($graphData = mysql_fetch_array($graph)){
$data[] = $graphData;
}
I'm sure this is a simple fix but tearing hair out here!