I am currently making a website and was wondering how to make it so that when a button is clicked it will update a field in the database by +1. This is sort of a ‘download’ system for photos so someone can view a photo and then press download button to access it and this will add +1 to the ‘download’ field for that photo in the table same as for like fields.
UPDATE table SET dl-count = dl-count + 1 WHERE id = :id
Another approach I have used for recording downloads is new table for it. For every download I add a new row to the table. This let you record more info about the download, such as a timestamp or user info.