#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    32
    Rep Power
    15
    Any easy way to check for duplicates?

    Or do I have to do this in a crappy way
  2. #2
  3. No Profile Picture
    Gödelian monster
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 1999
    Location
    Central Florida, USA
    Posts
    2,307
    Rep Power
    62
    For any field in a MySQL table, you have 3 options for field constraints:

    PRIMARY, INDEX, and UNIQUE

    In your case, just use the UNIQUE constraint and MySQL will generate a standard error if you try to insert a duplicate record. If you want, from there you can handle it with your server-side programming to generate the appropriate 'retry' message.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    32
    Rep Power
    15
    so say I have a database of people

    I go to enter in John Smith for the second time....there will be an error and I could make it do something?

    I'll read up on it on mysql.com i guess
  6. #4
  7. No Profile Picture
    Gödelian monster
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 1999
    Location
    Central Florida, USA
    Posts
    2,307
    Rep Power
    62
    What server-side programming language are you using?
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    2
    Rep Power
    0

    Since I have an interest in this thread, I will answer in my case.

    I am using PHP 4.01 -- how would this be done?

    Rod

Similar Threads

  1. Need query that ignores duplicate entries.
    By indivision in forum MySQL Help
    Replies: 2
    Last Post: October 25th, 2003, 09:05 PM
  2. Cronjob madness
    By eliteboo in forum Linux Help
    Replies: 10
    Last Post: July 14th, 2003, 10:49 AM
  3. eliminating duplicate entries
    By calebdzahnd in forum MySQL Help
    Replies: 2
    Last Post: December 30th, 2002, 03:39 PM
  4. Selecting duplicate entries using php with mysql?
    By strange1 in forum PHP Development
    Replies: 3
    Last Post: October 29th, 2002, 10:46 AM
  5. I need help with duplicate entries
    By supersonic in forum MySQL Help
    Replies: 4
    Last Post: August 3rd, 2001, 07:18 AM

IMN logo majestic logo threadwatch logo seochat tools logo