duplicate record notification
Posted: Thu Oct 22, 2009 11:42 am
In my database, after insertion of records, I want to know if the record inserted is duplicate or not. How can I do this ??
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Do a search on the database and compare the values.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 ??
Code: Select all
SELECT `id` FROM `db_name`.`tbl_to_srch` WHERE `some_clmn` = '$text';
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.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 ??