Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $dbname = "db";
- $dbuser = "dbuser";
- $dbpass = "dbpassword";
- $dbhost = "mysql.localhost.com";
- $db_con = mysql_connect($dbhost, $dbuser, $dbpass);
- if(!$db_con) {
- die("MYSQL FAILED TO CONNECT. BOOHOO");
- }
- mysql_select_db($dbname, $db_con);
- // this gets the current count
- $res = mysql_query("SELECT id FROM HitCounter");
- $row = mysql_fetch_row($res);
- echo "Hit's before incr: ".$row[0]."<br />";
- // this increments the count
- // NOTE: Do NOT use this table for more than one counter. Ie only MyFunkyButton
- $res = mysql_query("REPLACE INTO HitCounter (name) VALUES('MyFunkyButton');");
- echo "Total Hits: ".mysql_insert_id($db_con);
- mysql_close($db_con);
Add Comment
Please, Sign In to add comment