Gossamer Forum
Home : General : Databases and SQL :

Mmmm... primary key problems :(

Quote Reply
Mmmm... primary key problems :(
Hi,

I've got a really weird problem with a custom MySQL table.

A MySQLMan dump of the table in question looks like;

Code:
#
# Table structure for table 'Categories'
#
CREATE TABLE Categories (
Full_Name text ,
Count int(11) ,
CatID tinyint(11) DEFAULT '0' NOT NULL ,
FatherID int(11) ,
UNIQUE CatID (CatID)
);

#
# Dumping data for table 'Categories'
#

INSERT INTO Categories (Full_Name,Count,CatID,FatherID) VALUES('Art',NULL,'0','0');
INSERT INTO Categories (Full_Name,Count,CatID,FatherID) VALUES('Art/Photography',NULL,'127','0');

As you can see, there are only 2 entries in there.

Now, if I try to run the following command;

Code:
INSERT INTO Categories (`Full_Name`,`CatID`,`FatherID`) VALUES ('Art/Photography/Photography Subjects',56200,0);

..I get the following error message;

Quote:
Error

MySQL said: Duplicate entry '127' for key 1.

Query: INSERT INTO Categories (`Full_Name`,`CatID`,`FatherID`) VALUES ('Art/Photography/Photography Subjects',56200,0)

I just can't seem to get it to work. There has to be something silly/small that I 'm missing Frown

TIA

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Subject Author Views Date
Thread Mmmm... primary key problems :( Andy 6154 May 11, 2005, 9:44 AM
Thread Re: [Andy] Mmmm... primary key problems :(
Chaz 5867 May 11, 2005, 12:31 PM
Post Re: [Chaz] Mmmm... primary key problems :(
Andy 5817 May 12, 2005, 12:38 AM