Jump to content

download/link counter


Readme

Recommended Posts

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
Share on other sites

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
Share on other sites

horrible  :D

 

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.