开发者

Count hits for post using php and mysql

How i can develop a hit counter for my posts.

I have a mysql table with following cols

id title body hits

how i can increment hits by 1 whenever a user read post entry.

Please h开发者_StackOverflow社区elp.


In the page where you show your post you should update database.

I.e. you show post post.php?id=53 so in post.php you have to do

'UPDATE table SET hits = hits + 1 WHERE id = ' . (int) $_GET['id']
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜