Hits per day script
Posted: Tue Mar 22, 2005 8:10 pm
I currently have a script that counts the hits per day I get. It uses the MySQL database to store all the info. What I want to do is edit this script so that at the end of the day it will record the total hits for that day in another table in the database so that I can go back and view my hits per day from previous days. I have no clue how to even begin this task, I am a total PHP newbie, I just found this script on evilwalrus I believe.
If anyone knows how I can accomplish this then any help would be greatly appreciated. Thanks.
feyd | Please review how to post code using
If anyone knows how I can accomplish this then any help would be greatly appreciated. Thanks.
Code: Select all
<?php
mysql_connect('localhost','user','pass');//db host info
mysql_select_db('dbname');//db name
$date10 = date("j/m/Y"); //today's date
//this inserts new records
$daily1 = mysql_query("INSERT INTO `q_daily_count` (`ID`, `date`) VALUES (Null, '$date10')");
//this deletes the old records
$delete = mysql_query("DELETE FROM q_daily_count WHERE date <> '$date10'");
//this shows how many hits you have got in a day. just copy the function to a page where you want to
//show the count, make sure you type in correct username, password and datbase name.
//copy from here
$show = mysql_query("select * FROM q_daily_count");
$get = @mysql_num_rows($show);
$get = number_format($get);
echo $get;
?>feyd | Please review how to post code using
Code: Select all
andCode: Select all
tags. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]