-2

i want to have a simple counter for page view something like :

Page View :250
Unique Viewer: 150

i tried this :

id
page view
page unique view

...

if(user is unique)
{
+1 to page view and unique view
}
else
{
just +1 to page view
}

but this will show all views

i don't know which tables and fields i need, i want to show just for today. as you know with my table and fields i will have all visits, but i want just today's visits.

what table and filed's i need?

4

1 回答 1

1

您的问题是您对点击次数进行了 +1,因此您所拥有的只是总数。

您需要的是每个页面点击的单独行。所以你可以有一个类似这样的表:

TABLE PageViews
-----
[id]
[userId]
[ip]
[logTime]
[page]

对于每个页面视图,您插入一个新行。记录userId他们是否已登录,记录 IP,记录他们所在的页面等...

当您需要总计时,您可以按页面、日期、用户等查询您的数据……按 IP 分组以获取唯一性。

于 2013-09-25T14:18:33.030 回答