Phpmyadmin mysql foreign key help
Posted
by Alan
on Stack Overflow
See other posts from Stack Overflow
or by Alan
Published on 2010-03-19T10:58:36Z
Indexed on
2010/03/19
11:01 UTC
Read the original article
Hit count: 163
Hey guys i'm using phpmyadmin (php & mysql) and i'm having alot of trouble linking the tables using foreign keys.
I'm getting negative values for the field countyId (which is the foriegn key). However it is linking to my other table fine and it's cascading fine.
So when I go to add data there will be a drop box for the CountyId and the vlaues will look something like this,
" -1
1- "
Here is my alter statement,
ALTER TABLE Baronies
ADD FOREIGN KEY (CountyId)
REFERENCES Counties (CountyId)
ON DELETE CASCADE
© Stack Overflow or respective owner