SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru Nick Carlson's Avatar
    Join Date
    Aug 2003
    Location
    Denver
    Posts
    644
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Making sure there is no duplicate data.

    How do I make sure that duplicate data isn't stored in a table?

    In other words, if record 1 has the email address "bob@aol.com", I want to make sure that no other records that are created can have the email address bob@aol.com.

    Right now, I'm solving this problem through PHP by checking if that email address exists before inserting it. But isn't there a way to do this through mysql? I though there was a certain way to set up a table so that duplicate data couldn't be inserted.
    ncarlson.net - a programmer's dystopia

  2. #2
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Location
    marijampole
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    read some info on unique indexes, i don't got the time to give specific cmds to run don't got time atm but read that, add a unique index on that email column and everytime it will try to add something it will check if it's a dupe or not

  3. #3
    SitePoint Guru Nick Carlson's Avatar
    Join Date
    Aug 2003
    Location
    Denver
    Posts
    644
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you. I'll look into that.
    ncarlson.net - a programmer's dystopia


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •