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

    Join Date
    Jun 2000
    Posts
    56
    Rep Power
    15
    I have this problem that's starting to get on my nerv. I am going to add a new column to my table called topics, but they keep giving me the error "ERROR 1062: Duplicate entry '4' for key 2"

    The table format is as followed.

    topic_id | int(11) | | PRI
    parent_id | int(11) | | MUL
    root_id | int(11) | YES |
    name | varchar(255) | | MUL
    description | text | YES |
    create_dt | timestamp(14) | YES |
    modify_dt | timestamp(14) | YES |
    author | varchar(255) | YES |
    author_host | varchar(255) | YES |

    and I gave the following command :

    alter table topics add posts integer;

    Can someone pls help me out?

    Thanks in advance.

    --Ben.
  2. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15

    <<
    alter table topics add posts integer;
    >>

    it should be :

    "ALTER TABLE topics ADD posts int";

    //or
    //"ALTER TABLE topics ADD posts int(15)";
    //int(number)//




    ------------------
    SR -
    webshiju.com

    "The fear of the LORD is the beginning of knowledge..."
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    56
    Rep Power
    15
    I did that, but the same error persisted. I think it has something to do with the ways I set the primary key and indexes.

    the error is
    ERROR 1062: Duplicate entry '4' for key 2

Similar Threads

  1. Replies: 5
    Last Post: February 2nd, 2005, 12:28 AM
  2. UTF-8 problem in 4.1.1a
    By mehran20 in forum MySQL Help
    Replies: 1
    Last Post: February 8th, 2004, 02:21 PM
  3. fread problem: doesn t compile php code
    By ghorghor2002 in forum PHP Development
    Replies: 2
    Last Post: February 3rd, 2004, 05:25 AM
  4. WinNT4 problem
    By sandipguha in forum Windows Help
    Replies: 0
    Last Post: January 27th, 2004, 02:06 AM
  5. weird java problem..please help
    By suwandy in forum Java Help
    Replies: 1
    Last Post: January 26th, 2004, 04:13 AM

IMN logo majestic logo threadwatch logo seochat tools logo