# Ignoring Duplicate Entry

**URL:** <https://forum.kirupa.com/t/ignoring-duplicate-entry/323366>\
**Category:** programming\
**Created:** [June 27, 2011, 8:25pm UTC](https://forum.kirupa.com/t/ignoring-duplicate-entry/323366 "2011-06-27T20:25:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![DemonGibi](https://avatars.discourse-cdn.com/v4/letter/d/db5fbb/32.png) [@DemonGibi](https://forum.kirupa.com/u/DemonGibi)\
**Post date:** [June 27, 2011, 8:25pm UTC](https://forum.kirupa.com/t/ignoring-duplicate-entry/323366/1 "2011-06-27T20:25:25Z")

</div>

Hi there…  
I’m here with a new question for you all 🙂  
I have a table which has 4 columns…  
local\_id owner\_id friend\_id friend\_name  
In my app, every time user logins, the app sends the friend list of the app owner to the database(mysql)… Since he/she logged in the friend list may have changed… So I have to retrieve it every time…  
But when I insert new friend list to the table, it duplicates the old same ones…  
Something like this:  
local\_id owner\_id friend\_id friend\_name  
1\_\_\_\_\_\_\_\_\_23\_\_\_\_\_\_\_\_54\_\_\_\_\_\_\_\_John  
2\_\_\_\_\_\_\_\_\_23\_\_\_\_\_\_\_\_54\_\_\_\_\_\_\_\_John

I want it to ignore the entry which already in the table…  
(local\_id is auto increment id…)

I’m using this query to do this, but it won’t work…

INSERT IGNORE INTO `FriendsTable` (owner\_id, friend\_id, friend\_name) VALUES (23, 54, John)

I thought this query will skip the entry if it already exist in the table…  
But it doesn’t…  
Any ideas?
