Foreign key problem linking tables in phpMyAdmin

Posted by alan on Super User See other posts from Super User or by alan
Published on 2010-03-20T19:50:06Z Indexed on 2010/03/21 3:11 UTC
Read the original article Hit count: 527

Filed under:
|
|

I'm using phpMyAdmin (PHP & MySQL) and I'm having a lot 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 and cascading fine.

When I go to add data there will be a drop selection for the CountyId and the values 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

© Super User or respective owner

Foreign key problem linking tables in phpMyAdmin

Posted by alan on Server Fault See other posts from Server Fault or by alan
Published on 2010-03-20T19:50:06Z Indexed on 2010/03/21 23:31 UTC
Read the original article Hit count: 527

Filed under:
|
|

I'm using phpMyAdmin (PHP & MySQL) and I'm having a lot 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 and cascading fine.

When I go to add data there will be a drop selection for the CountyId and the values 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

© Server Fault or respective owner

Related posts about phpmyadmin

Related posts about php