Page 1 of 1

INSERT IGNORE for duplicate entry not working

Posted: Thu May 21, 2009 3:36 pm
by dv_evan
Dear All,

I tried running this code via the SQL query field in PHPMyAdmin:

INSERT IGNORE INTO `Table` (FName) VALUE ('Dave')

Table name='Table'
Column name='FName'

I read that this code suppose was suppose to prevent entering duplicate entries. But after entering 'Dave' in the FName column I still ended up with duplicates after executing this command. The name 'Dave' continue to be added everytime this command is executed.

Can you guys advise me if I am doing anything wrong. You can test it yourself and see if you are succeeding in preventing duplicate entries.

Looking forward to your responses.

Thanks
Dave

Re: INSERT IGNORE for duplicate entry not working

Posted: Thu May 21, 2009 3:59 pm
by Darhazer
Is FName set as unique in the database?

Re: INSERT IGNORE for duplicate entry not working

Posted: Thu May 21, 2009 4:10 pm
by dv_evan
Darhazer,

thank you thank you very much, crap I missed that, I did not set unique key. Now I do and it works.

thanks again mate

Dave