The online counting statistics of websites are inexplicably changing,

Source: Internet
Author: User
Tags apache log
The online counting statistics of websites become a big problem! You are the & nbsp; & lt ;? Php $ sql2 = & quot; UPDATEtongjiSEThit = hit + 1 whereid = 1 & quot; $ db-& gt; query ($ sql2); $ sql3 = & quot; the online counting statistics of websites become a big problem!
You are

$ Sql2 = "UPDATE tongji SET hit = hit + 1 where id = 1 ";
$ Db-> query ($ sql2 );
$ Sql3 = "select hit from tongji where id = 1 ";
$ Res3 = $ db-> query ($ sql3 );
$ Row3 = $ db-> getarray ($ res3 );
Echo $ row3 ['hit'];
?>
Visitor
This is a piece of code on the home page. The problem is as follows:
For example, when I log on to the database for half an hour, the data in the database is 11100, and the page shows 11100, the refresh time in half an hour can reach 11500 (sometimes larger than this change), and in this half an hour, a maximum of 10 users can visit the home page. The home page is just a jump page. What is the reason? how can this problem be solved? Please kindly advise!


------ Solution --------------------
The home page has been visited for many times. how can you determine that up to 10 users have visited the home page in the past half hour? maybe more, you cannot deny that each user can only access it once!
------ Solution --------------------
The relationship between uv and pv is that you record the number of visits, that is, pv, and what you need is uv, that is, the number of Accessed users. you need to use ip addresses to determine
------ Solution --------------------
Js code or code is not faulty... for example, refresh the page repeatedly or write the code to a loop.
Discussion

However, after opening the page, I did not go to any sub-pages. I immediately refreshed the page and added 20 or 30 to it.

------ Solution --------------------
First, check out if spider is making a task and check the apache log content.

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.