phpmyadmin 中的枚举值可以是这样的吗? “自述文件”=>1

发布于 2024-09-24 23:20:22 字数 185 浏览 2 评论 0原文

在此,我会看到自述文件,但该值将设置为 1

这可能吗?

编辑; 对不起。基本上我有一个网站。它的导航位于数据库中。它需要根据用户状态显示导航项,例如登录、管理员、博客、未登录和独立。这些工作,但是我想从数值转向人类可读的。我想保持我的脚本不变。那么,基本上,我可以让 enum Test 等于 1,就像 php 数组一样吗?

In this, I would see Readme, but the value would be set to 1

Is this possible?

edit;
Sorry. Basically I have a site. It's navigation is in the database. It need to display nav items depening on the users state, like, logged in , admin, blogger, not loggin, and indepenant. These work, however I would like to move from numerical values to human readable. I would like to keep my script the same. So, basicly, can I make the enum Test equal to 1, like a php array?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

瑾兮 2024-10-01 23:20:22

您使用的接口无法将符号名称分配给您所描述的值。

但是,您可以使用查找表,以便将字符串名称与每个数值相关联。也就是说,您可以继续在数据库表中存储 -1、0、1、2、3 等值,但您需要创建另一个表来将这些值映射到字符串中。然后,当您想要显示人类可读的名称时,您可以将其作为查找表的联接来执行。

The interface you're using has no way of assigning symbolic names to values like you describe.

However, you can use a lookup table so you can associate a string name with each numeric value. That is, you can continue to store values like -1, 0, 1, 2, 3 in your database table, but you would create another table to map those values into strings. Then when you want to show the human-readable names, you would do that as a join to the lookup table.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文