Page 1 of 1

duplicate record notification

Posted: Thu Oct 22, 2009 11:42 am
by lipun4u
In my database, after insertion of records, I want to know if the record inserted is duplicate or not. How can I do this ??

Re: duplicate record notification

Posted: Thu Oct 22, 2009 12:19 pm
by markusn00b
lipun4u wrote:In my database, after insertion of records, I want to know if the record inserted is duplicate or not. How can I do this ??
Do a search on the database and compare the values.

Code: Select all

 
SELECT `id` FROM `db_name`.`tbl_to_srch` WHERE `some_clmn` = '$text';
 

Re: duplicate record notification

Posted: Thu Oct 22, 2009 1:46 pm
by califdon
lipun4u wrote:In my database, after insertion of records, I want to know if the record inserted is duplicate or not. How can I do this ??
It seems to me you should want to check for possible duplicate before inserting a new record. In any case, what do you mean by "duplicate"? Duplicate ID number? Duplicate Name? Completely identical record? If it's a duplicate ID number, you should be using a primary key, which will reject any attempt to insert a duplicate key.