Codeigniter on duplicate key update with auto increment in MySQL

How to insert on duplicate key update in MySQL with the primary key is an auto increment number ? So the unique key cannot be specified for a new record..

Answer:

ODKU works not only for PRIMARY keys, it works on all UNIQUE keys. So u should just define another one unique key to catch your duplicates.
    ALTER TABLE `table` ADD UNIQUE (
    `field1`
/*    
...
    ,`fieldN`
*/
    );