i have a blog system and i would like to be able to have a section for 'most viewed' articles.
i just need a little push here, i want to make sure im on the right track...
i am going to have a field in the database called 'views'
now when a user goes onto comments.php it will add to the 'views' field on that certain article.
/**
*comments.php
*/
//retrieve the main article
if(isset($_GET['article'])){
$_SESSION['aid']=$_GET['article'];
$getarticle="SELECT *,DATE_FORMAT(date_posted,'%W, %b %D %Y at %l:%i %p') as thedate FROM ".TBL_BLOG_ARTS." WHERE artid = ".$_GET['article']." ORDER by date_posted ASC";
if(!$result = mysql_query($getarticle)){
echo mysql_error();
}else{
$num=mysql_num_rows($result);
//ADD TO THE VIEWS FIELD
$insert_view = "UPDATE ".TBL_BLOG_ARTS." SET views = '$viewnum' WHERE artid = ."$_SESSION['aid']." ";
mysql_query($insert_view);
}
how would i add to the number thats already in there? ( $viewnum )