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 Link to comment https://forums.phpfreaks.com/topic/92916-downloadlink-counter/ 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. Link to comment https://forums.phpfreaks.com/topic/92916-downloadlink-counter/#findComment-475977 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 Link to comment https://forums.phpfreaks.com/topic/92916-downloadlink-counter/#findComment-475989 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 Link to comment https://forums.phpfreaks.com/topic/92916-downloadlink-counter/#findComment-476004 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 Link to comment https://forums.phpfreaks.com/topic/92916-downloadlink-counter/#findComment-476132 Share on other sites More sharing options...
revraz Posted February 25, 2008 Share Posted February 25, 2008 You forgot your DB Connect line. Link to comment https://forums.phpfreaks.com/topic/92916-downloadlink-counter/#findComment-476137 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()); ?> Link to comment https://forums.phpfreaks.com/topic/92916-downloadlink-counter/#findComment-476171 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. Link to comment https://forums.phpfreaks.com/topic/92916-downloadlink-counter/#findComment-476173 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 Link to comment https://forums.phpfreaks.com/topic/92916-downloadlink-counter/#findComment-476178 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? Link to comment https://forums.phpfreaks.com/topic/92916-downloadlink-counter/#findComment-477007 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.