Php website homepage image clicks statistics, how to solve

Source: Internet
Author: User
On the home page of the php website, the page displays statistics on the number of clicks on the images, and then writes the statistical results of the previous day (I want to use the early morning as the basis) to the database every day. Now I have two questions: 1. how can we determine that the clicks on images are from the previous day, that is, how to distinguish between today and yesterday? 2. considering that there are many pictures on the home page of the website, if each picture is written to the database, statistics on the number of clicks on the home page of the php website
The picture counts the clicks and writes the previous day (I want to use the early morning as the basis) to the database every day.
Now I have two questions:
1. how to determine the number of clicks on images from the previous day, that is, how to distinguish between today and yesterday;
2. considering that there are a lot of pictures on the homepage of the website, if each picture is written to the database after clicking it, the database is under too much pressure, so I don't know if there are any other methods that are more labor-saving. ask for advice...

------ Solution --------------------
Obtain the timestamp. The difference is today or yesterday.
You can write the daily count in a txt file and save it to the database after one day or the next day. Otherwise, it will be slow to access the database once each click.
------ Solution --------------------
Does it make sense ?? In theory, if you want to implement it, you don't need to manually delete it. The program can implement it. The idea is as follows: if the image is not clicked once, 1 is added to the corresponding field of the database, in this way, will the clicks of images in a day be reduced ?? Of course, there will be a problem that cannot distinguish "today", "Yesterday", and "tomorrow", but this is a good solution, that is, before increasing the clicks DayThe date (as of "day") is saved to another field in the database, and then the date of this field is determined to be consistent with the date of the day. if it is consistent, continue to accumulate. if not, if it is changed to 0, it is accumulating. isn't it done ?? However, daily statistics do not seem to make much sense .......
Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.