Working with the database: delete/update
This is an open discussion with 2 replies, filed under General.
Search
Usually I use insert - with update set to true. If you would know/set the id/pk that is.
Usually I use insert - with update set to true. If you would know/set the id/pk that is.
Exactly what I needed. I overlooked this at first, but further investigation into MySQL's ON DUPLICATE KEY UPDATE
and it became clear.
Cheers!
Create an account or sign in to comment.
I have a field extension that is currently utilizing
Symphony::Database()->update()
to update a field. I need to fix a bug so that a new row is added to the table if one doesn't exist for that entry (i.e. affects existing Symphony entries). I'm not sure which is the best approach:Is there a preference or best practice here?