INSERT IGNORE for duplicate entry not working

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dv_evan
Forum Commoner
Posts: 42
Joined: Wed Apr 09, 2008 8:23 am

INSERT IGNORE for duplicate entry not working

Post 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
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

Re: INSERT IGNORE for duplicate entry not working

Post by Darhazer »

Is FName set as unique in the database?
dv_evan
Forum Commoner
Posts: 42
Joined: Wed Apr 09, 2008 8:23 am

Re: INSERT IGNORE for duplicate entry not working

Post 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
Post Reply