Hi,
Let's say I have a table in MySQL which represents an object:
TABLE: net_item, with the following fields:
id (primary)
provider_ref
install_cost
monthly_cost
...
If I want to make an update page, I'll have several input fields with current values in the database, and the possibility to change them.
One single Update button will make the changes in the database.
But what is the best way to do this?
I see 3 ways:
1. Use REPLACE in the MySQL query.
2. UPDATE net_item
SET provider_ref=$pr,
install_cost=$ic,
monthly_cost=$mc
WHERE id=$id
3. same as 2, but only for the fields that have actually been changed. Bu then I'll have many many if/then/else in my PHP code, to SET only if needed.
The solution I'd prefer is 3, what do you think?