Jump to content

Recommended Posts

I know this is very basic question.
I had been into a vacation for about 4 months, now
i 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 check
for existing record in the table first before adding the new record.

i want the duplicate checking to search from top to bottom of the record
looking 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.
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.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.