IGNORE keyword in MySQL

on simple definition IGNORE suppresses errors, errors are treated as warnings, while executing the INSERT Query, when INSERT IGNORE is used.
without IGNORE, a row that duplicates an existing UNIQUE index or PRIMARY KEY value in the table causes a duplicate-key error and the statement is aborted. With IGNORE, the row still is not inserted, but no error is issued.
when INSERT IGNORE is used, the insert operation fails silently for the row containing the unmatched value, but any rows that are matched are inserted.
The Query can be written as
$sql = ” INSERT IGNORE INTO tbl (id, col1) values (”,$val1)”;

Comments

Popular posts from this blog

PHP / SQL Security – The Big Picture

PHP / SQL Security – SQL Commands and Non-String Variables

Top 50 Web Hacking Techniques