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

Did you know?Explore Trending and Topic pages for more stories like this.
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

fopen() security
As i understood the usage of fopen() for it to function correctly the Dir you write to has to be rw

How do I create a 2D game "camera" to follow player?
In J2ME programming I'm targeting MIDP 2.0 devices.

I'm using gamecanvas and I was thinking t

Javascript or not?
How many people prefer javascript/ajax sites? How many prefer the good old fashion straight php sit

Open link with largest int string first
I have the following links i would like to open either all at once or one-by-one. How would i procee

explode() function problem maybe
Hi I'm having trouble searching my database. When I type two words in the search field it only searc

How to extract/download content from HTTPS page?
Hello to all the Members of this forum, Im Shoiab, A novice programmer in php.. for my first job I h

Pro-rata Billing in Periodic Billing for Rental
Hi guys,

We have a situation, where a rental contract starts at the mid of the month say

Date/Time and Checkbox
Hi Everyone,

I am trying to figure out how to insert the current date and tim

A little help in c#
i am doing a simple paint program using c# i want to draw with the mouse so i wrote the code of the

Entering Data Problem
Code: $result = mysql_query("SELECT * FROM flights");
while ($row = mysql_fetch_array($

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