我写了一些简单的文章脚本.现在,我要添加一些文章计数器.
I write some simple article scripts. Now I want add some article counter.
如果有3种可能性,则应将其设为商品计数器.
If there have 3 possibility it should make an article counter.
有什么好的建议,如何做得更好?
Is there any good suggestion how to do these better?
哪个数据库设计更好?把文章和计数数放在一张桌子上?或做成两张桌子?
Which database design is better? put article and count number in one table? or make two tables?
如果主要规则写入class.php这样的文件,然后将其包含在我的每一页中,谁能向我推荐一些php article counter script.
Can anyone recommend me some php article counter script, if the main rules write into a file like class.php then include into my every page.
谢谢.
推荐答案您可以做的是使用自动递增的数据库,并在查看页面时递增该值,并根据需要显示该值.
What you could do is use the database that auto increments and just increment that value when the page is viewed, and display that value if you want.
您可以在此处设置自动增量.
然后更新值"(您不必实际更新任何内容)
Then update the "value" (you don't have to actually update anything it will AI)
mysql_query("UPDATE COUNTER SET HITS = ''");然后只显示视图
$result = mysql_query("SELECT * FROM PAGEVIEWS"); while($row = mysql_fetch_array($result)) { echo $row['COUNTER']; }这是我的头上的-它应该可以工作.
This is off the top of my head - it should work.
更多推荐
如何使一个PHP的文章计数器?
发布评论