mysqli - MySQL: Adding a row with a certain value if it isn't in the table -
i have table setup unique column called, example, test
. want insert row column test
if there isn't row in table test
. know insert
query , throw error if existed (and wouldn't cause harm afaik), there way using mysql? i'm pretty sure can done functions i've never used before , think there's easier way.
thanks help, appreciate it!
sounds job insert ignore:
if use ignore keyword, errors occur while executing insert statement treated warnings instead. example, without ignore, row duplicates existing unique index or primary key value in table causes duplicate-key error , statement aborted. ignore, row still not inserted, no error issued.
Comments
Post a Comment