I made a simple little download management system to add download title, description, demo, download count, download link + id.

So far it works to display everything apart from the link I am not sure about. How do I get the id link onto the page instead of what ive done. I need it to count the number of times the link is clicked with id in it. I have made it add the id and have the count displaying but not sure how to get it to count the id. IE what link it should be. Sorry I cant explain it much but hes the page which displays the data:

http://www.dating.jamroll.net/downloads.php

PHP Code:
<?php
 $username 
"-----";
$password "----";
$host "localhost";
$database "dating_downloads";

mysql_connect($host,$username,$password) or die("Error connecting to Database!
mysql_error());

mysql_select_db($database) or die("Cannot select database!
mysql_error());

$getdownloads mysql_query("SELECT * FROM downloads ORDER BY id DESC"); //Retrieves all of the Data from the downloads table in your database
while($row mysql_fetch_assoc($getdownloads))
{
print(
"
$row[title] - Downloaded $row[count] Times<br/>
$row[description]<br/>
<a href=$row[demo]>View</a></span>
<a href=$row[url]/$row[id]>Download</a> </span><p/>"
);
}
?>
My downloads.php /\

PHP Code:
<?php require_once('Connections/cssconntect.php'); ?>
<?php
function GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue "")
{
  
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch (
$theType) {
    case 
"text":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? "'" doubleval($theValue) . "'" "NULL";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;
    case 
"defined":
      
$theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
      break;
  }
  return 
$theValue;
}

$editFormAction $_SERVER['PHP_SELF'];
if (isset(
$_SERVER['QUERY_STRING'])) {
  
$editFormAction .= "?" htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset(
$_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  
$insertSQL sprintf("INSERT INTO downloads (url, title, description, demo) VALUES (%s, %s, %s, %s)",
                       
GetSQLValueString($_POST['url'], "text"),
                       
GetSQLValueString($_POST['title'], "text"),
                       
GetSQLValueString($_POST['description'], "text"),
                       
GetSQLValueString($_POST['demo'], "text"));

  
mysql_select_db($database_cssconntect$cssconntect);
  
$Result1 mysql_query($insertSQL$cssconntect) or die(mysql_error());

  
$insertGoTo "index.html";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$insertGoTo .= (strpos($insertGoTo'?')) ? "&" "?";
    
$insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$insertGoTo));
}

mysql_select_db($database_cssconntect$cssconntect);
$query_Recordset1 "SELECT url, title, description, demo FROM downloads";
$Recordset1 mysql_query($query_Recordset1$cssconntect) or die(mysql_error());
$row_Recordset1 mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 mysql_num_rows($Recordset1);



mysql_free_result($Recordset1);
?>
<form method="post" name="form1" action="<?php echo $editFormAction?>">
  <table align="center">
    <tr valign="baseline">
      <td nowrap align="right">Url:</td>
      <td><input type="text" name="url" value="" size="32"></td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="right">Title:</td>
      <td><input type="text" name="title" value="" size="32"></td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="right" valign="top">Description:</td>
      <td><textarea name="description" cols="50" rows="5"></textarea>
      </td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="right">Demo:</td>
      <td><input type="text" name="demo" value="" size="32"></td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="right">&nbsp;</td>
      <td><input type="submit" value="Insert record"></td>
    </tr>
  </table>
  <input type="hidden" name="MM_insert" value="form1">
</form>
<p>&nbsp;</p>
my add.php


PHP Code:
<?php
 $username 
"----";
$password "-------";
$host "localhost";
$database "dating_downloads";

mysql_connect($host,$username,$password) or die("Error connecting to Database!
mysql_error());

mysql_select_db($database) or die("Cannot select database!
mysql_error());

if (
$id) {//if an id has been queried then...

$go =  MYSQL_QUERY("UPDATE downloads SET count = count + 1 WHERE ID = $home[id]");


if(!
$go) { die("Error!"); }//if there is a problem, slit wrists
$home MYSQL_FETCH_ARRAY($go);//define home


MYSQL_QUERY("UPDATE v4downloads SET count = count + 1 WHERE ID = $home[id]");//update table downloads, by adding 1 to the count of the id specified
MYSQL_FREE_RESULT($go);


header("Location: $home[url]");//redirect to the url specified for the specific id
}
?>
my downloadfile.php/\ not sure what its for. All help is GREATLY APPRECIATED. If you need to ask addition question or find msn easier add me on mikkaclarke@hotmail.com.