Hi Guys,
on my site when a user goes to the "downloads.php" page i update mysql to say downloads+1 to increment the number of downloads each time (but saying that not everyone who goes to the downloads page downloads something)
the code is pretty basic:
downloads.php
i was thinking a better way would be to place a button there when pressed the download box pops up and THEN it increments mysql but i'm not entirely sure where to go from there i can do the buttons ok:PHP Code:// start by grabbing the id...//////////////////////////////////////////////////
$id = $_GET['id'];
// get the file...///////////////////////////////////////////////////////////////////
$query1 = "SELECT * FROM `uploads` WHERE `id`='$id'";
$result1 = mysql_query($query1);
$row = mysql_fetch_array($result1);
$file_id = $row['file_id'];
$file_name = $row['file_name'];
// update the hit counter...////////////////////////////////////////////////////////
mysql_query("UPDATE `uploads` SET `downloads`=`downloads` + 1 WHERE `id`='$id'");
so when the button is pressed the downloads starts (it's not a specific filename) so the name of the downloaded file changes depending on what the uploader has called it kinda thing.PHP Code:<input type="submit" name="submit" value="download" />
any help would be great.
cheers
Graham



it's given me something to work on thanks mate

Bookmarks