Php + mysql how to implement the daily article clicks, such as the question, such as the table wzidcontenthit1 content 22 content 253 content 38... n content n5 how does php + mysql in the wz table be accessed every day?
For example
Table wz
Id content hit
1 Content 2
2 Content 2 5
3 Content 3 8
...
N content n 5
Each time you access the content in the wz table, the corresponding hit id will automatically increase by 1 update 'wz' set hit = hit + 1
Now I want to know how much code is added to their hit every day.
------ Solution --------------------
Create another table view with fields:
Postid INT // The id of the article to be read, in wz
Viewtime datetime or INT (10) is saved as a timestamp // read article time
Want to get the number of readings for an article of the current day
$ Today = date ("Y-m-d 00:00:00 ");
$ SQL = "SELECT count (*) AS 'viewnum' FROM 'View'
WHRER postid = '{$ postid}' AND 'viewtime'> '{$ today }'";
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service