Forum Moderators: open
What I would like to do is to output some information in my database grouped by Month Year ("May 2005").
$result=mysql_query("SELECT *, COUNT(published) FROM blog GROUP BY published DESC");
while($blog=mysql_fetch_array($result)){
echo "<li><a href=\"/".substr($blog["published"],0,4)."/".substr($blog["published"],5,2)."/\">".date("F Y",strtotime($blog["published"]))."</a> (".$blog["COUNT(published)"].")</li>";
}
This seemed to work fine, but then I realized its doing exactly what I told it, and is grouping my data by published, right down to the second.
So if there are five posts in a month, all with different days and times, their data will be listed five times.
Does anybody have any recommendations for grouping my data by Month Year?
Thanks