I use that and then I doCode:$query1="Select *,DATE_FORMAT(date_posted,'%W,%d %b %Y') as thedate FROM article INNER JOIN categories ON categoryID=catid WHERE DATE_SUB(CURDATE(),INTERVAL 30 DAY)AND artchild='0' ORDER BY date_posted DESC LIMIT 10 ";
devwebsites.com/sitedevs/Code:<?php if($num > 0) { $rows = array(); while($row_articles = mysql_fetch_assoc($blogarticles)) { array_unshift($rows,$row_articles); } foreach($rows as $row_articles) { ?> <div class="blog"> <span class="title"><?=$row_articles['title'];?></span> <span class="author">Posted by:<?=$row_articles['name'];?></span> <span class="date">The date posted: <?=$row_articles['date_posted'];?> </span> <div class="post"><?=$row_articles['comments'];?><a href="comments.php?aid=<?=$row_articles['artid'];?>&cid=<?=$row_articles['categoryID'];?>"> Comments(<? //echo $row_articles['artid']; //$thenum=row_articles['artid']; $getcomments = "SELECT * FROM article WHERE artchild='".$row_articles['artid']."'"; if(!$theResult=mysql_query($getcomments)){ echo mysql_error(); }else{ $num_comments=mysql_num_rows($theResult); echo $num_comments; } ?>) </a></div> </div> <?php } } ?>
It is ordering by date and I need to order it by artid (a column, just like date_posted).









Bookmarks