bilis_money Posted January 8, 2007 Share Posted January 8, 2007 I know this is very basic question.I had been into a vacation for about 4 months, nowi don't know where to begin this very newbie problem in php & mysql.I hope someone would help me here.here is the problem;I have a table "products" now i want to add records,i know how to add records but what i want really is to checkfor existing record in the table first before adding the new record.i want the duplicate checking to search from top to bottom of the recordlooking for duplicates then if there is none then add the record.i hope someone would guide me i'm really now confuse where to begin...a sample snippet of codes is very highly appreciated.Thanks a TON for advance. Quote Link to comment https://forums.phpfreaks.com/topic/33338-how-to-check-for-duplicate-first-before-adding-a-record/ Share on other sites More sharing options...
Jessica Posted January 8, 2007 Share Posted January 8, 2007 Before adding the record, do a SELECT based on the information you don't want duplicated. IE, if it's a `product_name` field, do"SELECT product_id FROM products WHERE product_name = '$name'";Edit to match your table.If you get any ids back, then you know it's a duplicate. Quote Link to comment https://forums.phpfreaks.com/topic/33338-how-to-check-for-duplicate-first-before-adding-a-record/#findComment-155776 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.