如果8天没有访问,然后是不是还要判断,
如果(只是原理)date()-最后访问日期>7,昨天-----提前7天全部变成0,当天+1;如果<7。。
是不是太麻烦了?如果我要调查的页面有几十张。

解决方案 »

  1.   

    呵呵.可以用update来做.前期可以把SQL写好,然后根据情况调用.
    不过应该还有再好些的设计.
      

  2.   

    请问如果要调查几十张页面的话,有没有什么好的法子?有人说COOKIE,请问用COOKIE怎么做?
      

  3.   

    表mCount
    id 自增id
    cCount 计数
    cPage 页面
    cDate 时间每次update的时候,先判断是否有该记录,
    没有:
    insert into mCount(cCount,cPage,cDate) values(1,'页面',curDate())
    有,得到id:
    update mCount set cCount=cCount+1 where id=$idmysql为例,如果要求是某页,则后面加上 and cPage='页面'
    当天:where cDate=CURDATE()
    当月:where MONTH(cDate)=MONTH(CURDATE())
    昨天:where cDate=CURDATE()-1
    7天内:where cDate>CURDATE()-7如果要必须是有记录的,则按cDate排序,取前几天记录,sum(cCount)
      

  4.   

    表mCount
    id 自增id
    cCount 计数
    cPage 页面
    cDate 时间每次update的时候,先判断是否有该记录,
    没有:
    insert into mCount(cCount,cPage,cDate) values(1,'页面',curDate())
    有,得到id:
    update mCount set cCount=cCount+1 where id=$idmysql为例,如果要求是某页,则后面加上 and cPage='页面'
    当天:where cDate=CURDATE()
    当月:where MONTH(cDate)=MONTH(CURDATE())
    昨天:where cDate=CURDATE()-1
    7天内:where cDate>CURDATE()-7如果要必须是有记录的,则按cDate排序,取前几天记录,sum(cCount)
      

  5.   

    表mCount
    id 自增id
    cCount 计数
    cPage 页面
    cDate 时间每次update的时候,先判断是否有该记录,
    没有:
    insert into mCount(cCount,cPage,cDate) values(1,'页面',curDate())
    有,得到id:
    update mCount set cCount=cCount+1 where id=$idmysql为例,如果要求是某页,则后面加上 and cPage='页面'
    当天:where cDate=CURDATE()
    当月:where MONTH(cDate)=MONTH(CURDATE())
    昨天:where cDate=CURDATE()-1
    7天内:where cDate>CURDATE()-7如果要必须是有记录的,则按cDate排序,取前几天记录,sum(cCount)
      

  6.   

    to qiushuiwuhen(秋水无恨) 
    你的方法不错,我觉得应该想秋水无恨学习。
      

  7.   

    qiushuiwuhen(秋水无恨) 
    你的方法不错,谢谢!
      

  8.   

    我还有个问题:请帮帮忙
    我的显示统计页面的时候,假如有以下几个内容:
    总访问量:
    今日访问量:
    当月访问量:
    a 页面访问量:
    B页面访问量:
    C页面访问量:
    ……
    我写QUERY是不是要写很多查询语句然后mysql_query?
    如果记录多的话是不是很慢?