How to create articles achieve sort like this Articles (articleid (INT), articledate (DATETIME) )
- April 2015 (2)
- March 2015 (1)
- Jun 2015 (5)
<h3>Archive</h3>
<ul class="list-unstyled arrow">
<?php
mysql_select_db($database_vcms, $vcms);
$query_Articles2 = "SELECT DATE_FORMAT(NOW(),'%b %Y') as M,
COUNT(1) FROM articles
GROUP BY M";
$Articles2 = mysql_query($query_Articles2, $vcms) or die(mysql_error());
$row_Articles2 = mysql_fetch_assoc($Articles2);
$totalRows_Articles2 = mysql_num_rows($Articles2);?>
<?php do { ?>
<li><a href="?type=article&action=achive&id=<?php echo $row_Articles2['Month'];?>"><?php echo $row_Articles2['Month'];?>
<span class="badge pull-right"><?php
mysql_select_db($database_vcms, $vcms);
$query_CheckAr2Count = "SELECT * FROM articles WHERE Year(articledate) = '$year' and MONTHNAME(articledate) = '$month'";
$CheckAr2Count = mysql_query($query_CheckAr2Count, $vcms) or die(mysql_error());
$row_CheckAr2Count = mysql_fetch_assoc($CheckAr2Count);
$totalRows_CheckAr2Count = mysql_num_rows($CheckAr2Count);
echo $totalRows_CheckAr2Count; ?></span>
</a></li>
<?php } while ($row_Articles2 = mysql_fetch_assoc($Articles2)); ?>
</ul>
Aucun commentaire:
Enregistrer un commentaire