Jump to content

Download file update dastabase url and form.


redarrow

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]
Link to comment
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.