A
A
Andrey Angelovich Stock2018-06-07 15:03:45
PHP
Andrey Angelovich Stock, 2018-06-07 15:03:45

Overwriting DB values?

Hello! Please help me understand the following point:
In my application there is a button, by clicking on which the data from the form is written to the database and then formed into a separate page that is unique for each user. Tell me, please, how can I make it so that when you click on this button again, the data is overwritten. For example, on the form page, the user filled in the fields, clicked on the button, the page he needed was formed, but he saw an error and returned back to fix it, clicked the button again and the page was formed with new corrected data
. I don’t understand how to make the button “understand” that this is a second press and the data needs to be overwritten

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
ThunderCat, 2018-06-07
@your_uncle

Without specific implementation details of yours - how you record, what you use and how it is stored - it's hard to say anything. In general, an object performs an UPDATE if the entity id already exists, and does an INSERT if it does not. But if it is a related single entity, it might still check against the foreign key to see if there is already an entry with that foreign key.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question