在自己开发的静态网站上经常会用到这样一个功能;静态html页面怎么实现文章点击次数的动态添加?
故今日分享一个静态html页面增加文章点击次数例子:
HTML代码:
/p>
Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">;
;
更新点击数点击次数:
php代码:
//更新点击数
if($_GET['action'] == 'dj'){
$link=mysql_connect('localhost','root','');
mysql_select_db('phphtml',$link);
mysql_query("update `newscontent` set
`click`=click+1 WHERE `newsid`='".$_GET['mid']."'");
$re=mysql_query("select * from newscontent where
newsid='".$_GET['mid']."'");
$rows=mysql_fetch_assoc($re);
$str=$rows["click"];
echo "document.write('".$str."');\n";
}
?>