Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using onDuplicate() with insertMulti() #1042

Open
palsypentertainment opened this issue Jan 21, 2025 · 0 comments
Open

Using onDuplicate() with insertMulti() #1042

palsypentertainment opened this issue Jan 21, 2025 · 0 comments

Comments

@palsypentertainment
Copy link

palsypentertainment commented Jan 21, 2025

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant