0

I have a bunch of insert querys running and some of them fail with a duplciate entry.

I want to see a log where it says "Error: Duplicate key" and that tells me the EXACT INSERT query that fails so I can see what keys are duplicated.

Thanks

Edited by pritaeas: Restored. Didn't notice the different forum.

3
Contributors
4
Replies
16
Views
3 Years
Discussion Span
Last Post by diafol
0
mysql_query($sql); //or use mysqli equivalents
if (mysql_errno() == 1062) {
    echo "Duplicate key error: <pre><code>$sql</code></pre>";
}
0

I went ahead with REPLACE but thank you

And this isnt a PHP question.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.