This is the section where u display all the links in the database
<?php
//Connect and select database
$linkid = mysql_connect("","",""); //your inform host,user,pass
mysql_select_db("",$linkd); //add your dbname
$sql_links ="SELECT *FROM links ORDER BY hits DESC";
$result_links = mysql_query( $sql_links ) or die( mysql_error() );
//Print out all the links in the database
while( $links = mysql_fetch_array( $result_links ) )
{
echo "<a href=\"http://www.domainName.com/links.php?id=" . $links[id] . "\">" . $links[name] . " - " . $links[hits] . "</a>";
}
?>
This is links.php which will track the links and send them to their link
<?php
//Connect and select database
$linkid = mysql_connect("","",""); //your inform host,user,pass
mysql_select_db("",$linkd); //add your dbname
$result_links = mysql_query( $linkid ) or die( mysql_error() );
$sql_update = "UPDATE links SET hits = hits + 1 WHERE id = '" . $_GET[ 'id' ] . "'";
$result_approve = mysql_query( $sql_update ) or die( mysql_error() );
$links = mysql_fetch_array( $result_links )
header( "Location: " . $links[ "url" ] . "");
exit;
?>
I am very rusty with php, I havent touched it in at least 5 month so please dont laugh at my scripts instead tell me my mistakes... I really needed the practice, so please tell me my mistakes. Thanks in advanced.