Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Can not add links to database!!!

Quote Reply
Can not add links to database!!!
Hello,

I am getting the following error whenever a user try to add a new link into my database:


Failed to execute query: 'INSERT INTO lsql_CatLinks (LinkID,CategoryID) VALUES (?,?)' Reason: Duplicate entry '1' for key 1


Somehow, I have corrupted the lsql_CatLinks database by clicking on Primary/Index/Unique...etc. So, I am unable to add records to my database anymore...



This is what I am getting when I build:

Building Detailed pages ...

A fatal error has occured:
GT::SQL::Table (25683): Wrong argument passed to this subroutine. Usage: Must pass category id to template_set at (eval 39) line 7.


Please enable debugging in setup for more details.
Can you help please or show me what would the default DB has:


thank you in advance

Mark

This is what I have in the MySqlMan:

Code:


MySQL message:
Column LinkID set as index.




Field Type Null Key Default Extra ACTION
LinkID int(10) unsigned MUL 0 Change Drop Primary Index Unique
CategoryID int(10) unsigned PRI 0 Change Drop Primary Index Unique



Keys:

Key name Unique Field Action
PRIMARY YES CategoryID Drop
CategoryID YES CategoryID Drop
catlnndx YES CategoryID Drop
lndx No LinkID Drop
LinkID No LinkID Drop
LinkID_2 No LinkID Drop

Last edited by:

Mark2: Sep 21, 2002, 6:46 PM
Quote Reply
Re: [Mark2] Can not add links to database!!! In reply to
This is a good reason not to play with your table structures :)

The only keys you should have are:

catlnndx and lndx

Last edited by:

Paul: Sep 22, 2002, 2:47 AM
Quote Reply
Re: [Paul] Can not add links to database!!! In reply to
Yes! you are right, I should've not touched this database.

But for now, I need a way to fix it. Did you say I have to remove all keys except the one that you have indicated. what about the first table and the second and what type of keys they should be...

Can some one display the his/her lsql_CatLinks tables as they should be... and thank you in advance..

Regards..

Mark
Quote Reply
Re: [Mark2] Can not add links to database!!! In reply to
Quote:
Did you say I have to remove all keys except the one that you have indicated.

Yup.

Quote:
what about the first table and the second and what type of keys they should be

Not sure what you mean here.

Simply clicking "Drop" next to the unwanted keys should fix it, especially the primary key which is probably the main cause of your error.
Quote Reply
Re: [Paul] Can not add links to database!!! In reply to
Greetings,

Thanks for your help. Now, I ended up with the following tables.

Is this right?!!

Thank you

Mark



MySqlMan:
Code:


Field Type Null Key Default Extra ACTION
LinkID int(10) unsigned MUL 0 Change Drop Primary Index Unique
CategoryID int(10) unsigned MUL 0 Change Drop Primary Index Unique


Keys:

Key name Unique Field Action
catlnndx NO CategoryID Drop
lndx No LinkID Drop