Page 1 of 1

check duplicate

Posted: Sun Jan 24, 2010 10:51 pm
by fer0an
hello
I've a db with some data
I want to check content, if title dosen't exist create it and if exist continue.
My db column is -->id--title--introtext--fulltext--link
anyone can help me?

Re: check duplicate

Posted: Mon Jan 25, 2010 1:30 am
by amargharat
If you are going to check with "title" then you should declare "title" as an unique key. so duplicate data in a "title" field will be ignored

Now, write the code to insert the data

e.g. insert into table_name(title) values('Concept')

above query insert new entry if value "Concept" not exists.

else entry will be ignored if exists.

so no need to check the condition