SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: Duplicates

  1. #1
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Port Sunlight
    Posts
    815
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Duplicates

    How do I prevent duplicated records being entered???

    I have comments that are entered and hold the article_id which is ok, and when I insert record it is saying that I can't have duplicates with article_id, how do I prevent this from occurring.

  2. #2
    masquerading Nick's Avatar
    Join Date
    Jun 2003
    Location
    East Coast
    Posts
    2,215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is article_id your 'primary key' or 'unique'?
    Nick . all that we see or seem, is but a dream within a dream
    Show someone you care, send them a virtual flower.
    Good deals on men's watches

  3. #3
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Port Sunlight
    Posts
    815
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well in my articles table article_id is my primary key
    In my comments table it is just a field and nothing else.

  4. #4
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Port Sunlight
    Posts
    815
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorted it, in my insert record behaviour I didn't have comments_id as an unused primary key. Small things eh

  5. #5
    does not play well with others frezno's Avatar
    Join Date
    Jan 2003
    Location
    Munich, Germany
    Posts
    1,391
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you post your table structure (DESCRIBE tablename)? makes it a little easier
    We are the Borg. Resistance is futile. Prepare to be assimilated.
    I'm Pentium of Borg.Division is futile.Prepare to be approximated.

  6. #6
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Port Sunlight
    Posts
    815
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by frezno
    Can you post your table structure (DESCRIBE tablename)? makes it a little easier
    I have fixed the problem now, but thanks anyway. Moving on too bigger and more complex problems. Well for me anyway, for you guys it's probably a walk in the park, but I know its a learning curve.


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
  •