I've been struggling with finding the right way to delete a record from my database through code. Here's the deal:
For a school assignment I was tasked to build a website for which the primary function is a sort of 'lottery'.
As you can see here, in the box where the "68" is typed in, my clients customers need to fill in a code. This code tells them whether or not they have won a prize. "68" is a winning number, as it's indicated above the "Claimen!" button. The clients press the "Claim!" button.
After the "Claim!" button is pressed, the users are supposed to fill in their name, surname, etc. The prize "Waardebon van 100 euro" that was linked to lottery number "68" is still there, so the client remembers what they won. Now on this picture I have encircled the button which is supposed to send the confirmation e-mail and after that is done, delete the record which contains the lottery number and it's prize. That's only logical as a code isn't supposed to be entered again. It's the last part where I have a problem. I don't know how to delete a record from a database using code, and I can't find an answer based on my needs. I have tried something, which only deleted the first record of the database. For reference, this is how my database looks like:
As far as I know, my lottery function doesn't search for the entry in the database by the number on the sides but via the number in the "Nummer lot" column. This is the code I use to search for the entry in the first place, before all the claiming and stuff happens:
How do I add a code to delete that same record from my database? My needs require it to be in the final "Indienen" button after the user has filled in their info. This button as of now contains no code. I'm literally clueless as of now and have no idea how to continue on from here.
Thanks in advance for answering!