Readme Posted February 25, 2008 Share Posted February 25, 2008 I have a link on my website and would be very interested to find out how many people click that link. Does anyone know any free click counter scripts? Thanks Quote Link to comment Share on other sites More sharing options...
revraz Posted February 25, 2008 Share Posted February 25, 2008 If you have access to a DB, just write one. Shouldn't be hard at all. Quote Link to comment Share on other sites More sharing options...
Readme Posted February 25, 2008 Author Share Posted February 25, 2008 If you have access to a DB, just write one. Shouldn't be hard at all. Yes, I have DB just write one - low skill I need full code Quote Link to comment Share on other sites More sharing options...
redarrow Posted February 25, 2008 Share Posted February 25, 2008 see if that works mate..... <?php //database connection. $x=$_POST['x']; $x="GO TO GOOGLE"; echo "<a href='http://google.com'>$x</a>"; $sql="UPDATE link_counter set count=count+1 WHERE x='$x'"; $res=mysql_query($sql)or die(mysql_error()); ?> database name: link_counter id int not null auto_increment primary_key count int not null deafult 0 x text not null default GO TO GOOGLE Quote Link to comment Share on other sites More sharing options...
Readme Posted February 25, 2008 Author Share Posted February 25, 2008 hmm Connected to MySQL GO TO GOOGLENo database selected <?php $username = "xxx"; $password = "xxx"; $hostname = "xxx"; //connection to the database $dbhandle = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); echo "Connected to MySQL<br>"; $x=$_POST['x']; $x="GO TO GOOGLE"; echo "<a href='http://google.com'>$x</a>"; $sql="UPDATE link_counter set count=count+1 WHERE x='$x'"; $res=mysql_query($sql)or die(mysql_error()); ?> Something wrong Quote Link to comment Share on other sites More sharing options...
revraz Posted February 25, 2008 Share Posted February 25, 2008 You forgot your DB Connect line. Quote Link to comment Share on other sites More sharing options...
Readme Posted February 25, 2008 Author Share Posted February 25, 2008 horrible GO TO GOOGLE Table 'link_counter.link_counter' doesn't exist <?php $dbhost = "localhost"; $dbuser = "root"; $dbpass = ""; $dbname = "link_counter"; //connect $db = mysql_pconnect($dbhost,$dbuser,$dbpass); mysql_select_db("$dbname",$db); $x=$_POST['x']; $x="GO TO GOOGLE"; echo "<a href='http://google.com'>$x</a>"; $sql="UPDATE link_counter set count=count+1 WHERE x='$x'"; $res=mysql_query($sql)or die(mysql_error()); ?> Quote Link to comment Share on other sites More sharing options...
DarkerAngel Posted February 25, 2008 Share Posted February 25, 2008 Do you have your MySQL database/table structure built? From the error I assume not. Your Database would be "link_counter" And your Table would be "link_counter" The way you have this code written. Quote Link to comment Share on other sites More sharing options...
Readme Posted February 25, 2008 Author Share Posted February 25, 2008 uups Do you have your MySQL database/table structure built? No im noobie Quote Link to comment Share on other sites More sharing options...
Readme Posted February 26, 2008 Author Share Posted February 26, 2008 Do you have your MySQL database/table structure built? How do make that? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.