Welcome Guest, Not a member yet? Register   Sign In
Insert or update if key exists
#2

[eluser]Bramme[/eluser]
And I've solved it myself (don't mind if I double-post it here, for future reference):

After reading the docs again, more carefully, I realised that the query has to be:

INSERT INTO table (option_a, option_b, account_id) VALUES (‘val1’, ‘val2’, $id) ON DUPLICATE KEY UPDATE option_a = 'val1', option_b = 'val2'


Messages In This Thread
Insert or update if key exists - by El Forum - 01-19-2011, 01:42 PM
Insert or update if key exists - by El Forum - 01-19-2011, 01:56 PM
Insert or update if key exists - by El Forum - 01-19-2011, 02:54 PM
Insert or update if key exists - by El Forum - 02-13-2011, 07:51 AM



Theme © iAndrew 2016 - Forum software by © MyBB