redarrow Posted April 1, 2006 Share Posted April 1, 2006 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 https://forums.phpfreaks.com/topic/6321-download-file-update-dastabase-url-and-form/ Share on other sites More sharing options...
jmag Posted April 1, 2006 Share Posted April 1, 2006 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 https://forums.phpfreaks.com/topic/6321-download-file-update-dastabase-url-and-form/#findComment-22844 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.