Forum Moderators: coopster
link.php?id=1
link.php?id=2
link.php?id=3
etc...
you will have a table called links with 3 fields - id (primary key, int, auto-increment), url (varchar) & clicks (int).
then in link.php you have:
<?php## CONNECT TO DATABASE ##
//Get ID
$id = $_GET['id'];
//Update clicks
mysql_query("UPDATE links SET clicks=clicks+1 WHERE id='$id'");
//Retrieve URL
$sql = mysql_query("SELECT url FROM links WHERE id='$id'");
$fetch = mysql_fetch_row($sql);
$url = $fetch[1];
mysql_close();
//Redirect to URL
header ("Location: $url");
?>