Skip to content

Using onDuplicate() with insertMulti() #1042

@palsypentertainment

Description

@palsypentertainment

There is an old, closed thread regarding a similar issue, but it doesn't state if it was a user error or what.

I am having issues with using onDuplicate() with insertMulti()...... I'm getting a duplicate error at runtime.

Can someone confirm that onDuplicate() can be used with insertMulti()? Looking into the class, insertMulti() is just an insert() in a loop, right?

Here's my code of what I'm doing

$firstRow = reset($data);  
$updateColumns = array_keys($firstRow);  
$db->onDuplicate($updateColumns, $id);  
$result = $db->insertMulti($tablename, $data);

Am I'm doing it wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions