Reputation:
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
Upvotes: 0
Views: 275
Reputation: 5889
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
Upvotes: 3