Hi, I have a download page on my site and I want to record in a mySQL database how many times each file has been downloaded. I have a database table set up with a field for the file name and a field for the number of times it has been downloaded. Say I have 3 files in the table, could you please give me an SQL query that would get the current value for the number of downloads from the database, increment it by 1 and return the new value to the database. The variables I ahve used are: $file - the filename $no - the number of times it has been downloaded. The download page has links like this: http://myurl/download2.php?file=thefilename
Thanks in advance.
// Update the number of downloads: UPDATE table SET no=(no + 1) WHERE file='$filename';
// Fetch the number of downloads: SELECT no FROM table WHERE file='$filename';
Thanks a lot, much appreciated. 🙂