Hits this week counter


Posted on 16th Feb 2014 07:03 pm by admin

I have a counter on my site that tracks hits, IP's, etc. into a mySQL database. It also includes the date in the entry. The code I'm using, that's not working, to try and retrieve the amount of hits in the last 7 days is:
$hitsWeek = mysql_result(mysql_query("SELECT SUM(`hits`) FROM `stats` WHERE `date` > '$time-604800' GROUP BY `date`"),0);
However, I'm getting this error: Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 10 in /var/www/main.php on line 50

Can anybody help me out with this?

No comments posted yet

Your Answer:

Login to answer
190 Like 32 Dislike
Previous forums Next forums
Other forums

captcha error
I have been trying to implement a captcha in php...

here is the code..
Code: (php) [Select

calendar dates and hours compare problem
i have a calendar in wordpress, everything works great except that i can make 2 meetings at the same

How could I do this?
Ive got a simple lottery game, and am using an sql database to keep track of the numbers bought. But

PHP code for a proxy
I was wondering which function I could use to create an online proxy tool. I was thinking cURL would

Oracle11g Patch issue
Hi all,

I'm getting the following error while installing Oracle11g Patch 11.1.0.7.0 on IBM-AI

Why do I get this error?
Error:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or

How do I know when getBounds Method is ready to be called.
I have an application that changes out stylesheets client side. Once I change stylesheet the browse

How do I replace any number of character occurences with one occurrence?
How do I replace any number of character occurences with one occurrence?

Let's say I have:

Date help - fetch dates for Mondays between xxx and yyy?
Does anyone know the best way to do this? I have two dates, say:

2010-01-26 and 2010-05-30

Getting number of affected rows in SQLPLUS..
Hi everyone,
I have a shell script where i am invoking sqlplus, running a query and saving t

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash