phpMyAdmin外键下拉字段值 [英] phpMyAdmin foreign key drop-down field values

查看:283
本文介绍了phpMyAdmin外键下拉字段值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用phpmyadmin( php & mysql ),并且遇到很多链接使用外键的表。



字段 countyId (这是外键)。但是它链接到我的另一个表罚款,它的级联罚款。

当我去添加数据将有一个下拉框 CountyId 和值看起来像这样,

  -1 

1 -

这是我的改变语句:

 ALTER TABLE Baronies 
添加FOREIGN KEY(CountyId)
REFERENCES县(CountyId)
ON DELETE CASCADE

解决方案

正如我在 phpymadminWiki


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 foreign key). However it is linking to my other table fine and it's cascading fine.

When I go to add data there will be a drop box for the CountyId and the values look something like this,

-1

1-

Here is my alter statement:

ALTER TABLE Baronies
ADD FOREIGN KEY (CountyId)
REFERENCES Counties (CountyId)
ON DELETE CASCADE

解决方案

As i explained on ServerFault:

It is not negaitve number, the feature of phpMYAdmin is to show foreign key value and a custom description field next to it. In the referenced table (Counties) you can go to "Relation view" and under the table there is a select box "Choose field to display", in which you choose value that will be displayed next to CountyID value in the referencing table (Baronies). Also see: phpymadminWiki

这篇关于phpMyAdmin外键下拉字段值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆