How can I tell if the failure to write to the database is due to duplication???
Duplicate data I need to deal with, other reasons I have to deal with it separately.
Reply to discussion (solution)
Check for duplicates before inserting!
Database has error Reporting
Echo Mysql_error ();
Can you get the reason by error? I just need to make a distinction between the reasons for the repetition, and check every record.
What repetition? Duplicate primary key ID or what?
How can I tell if the failure to write to the database is due to duplication???
Duplicate data I need to deal with, other reasons I have to deal with it separately.
When new data is added, it is necessary to determine whether there is duplicate data, stop the operation, or skip and get the duplicate primary key for easy querying.
Take MySQL for example:
MySQL is judging mysql_error.
Mysqli, Judge Mysqli_errno.