简体   繁体   中英

Total page views in mysql

Hello everyone i think this is good question. I am using page counter script for my website but i want to see in my dashboard total page view not only one page total viwed.

I want Total page view HOW CAN I MAKE IT ?

This is my page counter code :

mysql_query("UPDATE posts SET `post_view` = `post_view`+1 WHERE post_id ='$page_id'");

This is my table: Table images

First of all: Use PDO or mysqli instead of mysql_* functions. Cause they are deprecated and get removed in one of the next versions of PHP.

For your problem have a look at the MySQL function SUM() .

SELECT SUM(post_view) total_page_views FROM posts

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM