/*Ok so I have this code and it works fine but the problem is that it gives an out put like this one:
2014
June
2014
August
Supposedly I would like to have august just below June...I tried putting the Group by Year(Postdate)..and it almost gave me the solution but the month AUGUST is missing...like this:
2014
June*/
<?php
$stmt = $db->query("SELECT Month(postDate) as Month, Year(postDate) as Year FROM posts ORDER BY postDate");
while($row = $stmt->fetch()){
$monthName = date("F", mktime(0, 0, 0, $row['Month'], 10));
$slug = 'a-'.$row['Month'].'-'.$row['Year'];
echo"<li>$row[Year]</a><ul class='sub1'><li><a href='$slug'>$monthName</a></li></ul></li>";
}
?>
RonKevinT.Manuela 0 Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.