I would like to use ON DUPLICATE KEY UPDATE
in Zend Framework 1.5, is this possible?
Example
INSERT INTO sometable (...)
VALUES (...)
ON DUP
As a sidebar, you can simplify the ON DUPLICATE KEY UPDATE
clause and reduce the amount of processing your script needs to do by using VALUES()
:
$sql = 'INSERT INTO ... ON DUPLICATE KEY UPDATE id = VALUES(id), col2 = VALUES(col2), col3 = VALUES(col3)';
See http://dev.mysql.com/doc/refman/5.1/en/insert-on-duplicate.html for more information.