Ignore track?
am 04.10.2007 00:53:33 von MattMika
I have an admin page where auth'd users upload a csv file for
insertion of email addresses into a unique field in a mySQL DB.
Using "INSERT IGNORE" how do I track the occurence of an ignore?
I'd like to print a message saying something like "X email addresses
were duplicates and were not inserted into the DB."
I believe ignore are written to binary log file. Is there a way to
track these writes to the log file for output to a php error message?
TIA
Matt Mika
Re: Ignore track?
am 04.10.2007 13:58:33 von Captain Paralytic
On 4 Oct, 05:19, "J.O. Aho" wrote:
> MattMika wrote:
> > I have an admin page where auth'd users upload a csv file for
> > insertion of email addresses into a unique field in a mySQL DB.
>
> > Using "INSERT IGNORE" how do I track the occurence of an ignore?
>
> You check with mysql_info() after each insert.
>
> --
>
> //Aho
I tend to use mysql_affected_rows(), particularly where I am only
inserting a single record. Then I can easily check the result by:
if (!mysql_affected_rows()) {
//Record was not inserted
}