Jump to content

Archived

This topic is now archived and is closed to further replies.

redarrow

Download file update dastabase url and form.

Recommended Posts

if you wanted to download a file via the form or the url how do you do that then update the database colum by one.

if a user press a link click here they get the file, Then the database gets a 1 in a colum and then it increments as people download the same file updating that colum.

and in another colum with the number starting at 1000 a count down happens on any file downloaded a 1 is tacken away from the 1000.




Code example BUT NEEDS HELP for download file and update database by 1 then total_downloads - 1 from 1000.
[code]
<?

$_post($filename);

$filename="john.zip";

$link="<a href='http://$filename'>get file</a>";

echo $link;

if ($_post($filename) {


$result = mysql_query("UPDATE download_info SET how_meny_times='+1'")
or die(mysql_error());

} elseif {


($_post($filename) {

$result = mysql_query("UPDATE download_info SET total_downlaods='-1'")
or die(mysql_error());

}
  
   }

// In how_meny_times field got the number o.

// In total_downloads field got the number 1000 in.

?>
[/code]

Share this post


Link to post
Share on other sites
I think easiest way would be to have two pages. One page listing downloadable files, then when a user clicks a file they are redirected to another page which updates the database and serves them the file.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.