hit counter and more
Posted: Mon Dec 04, 2017 3:07 pm
I have occasionally looked at ideas for my sites and other projects
so now that I have a table in my database I was thinking, what can I do....
so with the database I was wondering if I could leverage it better?
seems obvious, then....
so then I guess....
so given the power of PHP and SQL, can I do better?
Google seems to be able to do more with their hit counter, can I expand on this crude design, how about a row for unique hits
Code: Select all
CREATE TABLE `counter` ( `counter` INT( 20 ) NOT NULL );
INSERT INTO counter VALUES (0);
Code: Select all
// Connects to your Database
mysql_connect("your.hostaddress.com", "username", "password") or die(mysql_error());
mysql_select_db("Database_Name") or die(mysql_error());
Code: Select all
mysql_query("UPDATE counter SET counter = counter + 1");Code: Select all
$count = mysql_fetch_row(mysql_query("SELECT counter FROM counter"));Code: Select all
echo $countGoogle seems to be able to do more with their hit counter, can I expand on this crude design, how about a row for unique hits