How to make a database entry on page load and edit it with later workflows

I am messing around trying to make a simple game and have a question about how to store the id of a database insert for later use.

On page load I have a database insert to make a new entry in a table called game. When the user updates a value on the page I update the value in the game table using a database update.

How can I save the id for the game that was created so I can use it to update the correct table in a secure way?

Can I use global data/query params or would a user be able to modify the value of that and change the id before updating and mess up which game id gets updated? I also saw sessions but I’m not entirely sure how they work or if they would do what I need.

Hope I explained what I am trying to do in a halfway decent manner.

Community Page
Last updated: