I have the following script to track the downloads
<? php
$cm = "Location: $file";
header ($cm);
$db_user = "username";
$db_passwd = "paswword";
$db_name = "dbname";
$db = mysql_connect("localhost", $db_user, $db_passwd);
mysql_select_db($db_name, $db);
mysql_query("UPDATE downloads SET counter=counter+1 WHERE file='$file'",$db);
if (mysql_affected_rows($db) < 1) {
$result = mysql_query("INSERT INTO downloads VALUES ('$file', 1)", $db); }
mysql_close($db);
?>
and the following table set up
file | counter
(url) | (number of clicks)
and i found a script onthis forum to display the counter on the page....
<?
$conn = mysql_connect("localhost", "username", "passwords");
mysql_select_db("database");
$query = "select * from downloads";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_object($result);
$dlnum = $row->dlnum;
echo "Downloads of something: ".$dlnum;
mysql_close($conn);
?>
my questions is... i'm going to have multiple download links on the same page... how would i change the second script to be able to display the counter results? and how would i displayed multiple different counters on one page for each download??
any help would be great....
K