How to insert a row and ignore only UNIQUE contraint errors, without using SELECT
问题 I have a table with a column that must have UNIQUE values (but it could be also a multiple-column UNIQUE index, the problem is the same). In my PHP script I have to insert a row in that table. I'm searching for a way, not MySQL-specific, to exit the PHP script if there's a problem, and the problem is not a violation of a UNIQUE constraint. To make things more easy I don't want to use a SELECT query before :D Currently I'm doing something like this: try { $stmt = $dbh->prepare($someinsertquery