I would like to modify this MySQL query to insert the row only if it does not exist. Otherwise, I would like to update the existing row.
Yeah, use ON DUPLICATE KEY UPDATE
ON DUPLICATE KEY UPDATE
for that. Here is an example:
INSERT INTO (, ) VALUES (, ) ON DUPLICATE KEY UPDATE = 'update CONTENT'; important is the primary key (underlined in phpMyAdmin table). 0 讨论(0) 查看其它4个回答 发布评论: 提交评论 加载中... 验证码 看不清? 提交回复 热议问题
important is the primary key (underlined in phpMyAdmin table).