列出下拉式PHP MySQL中的枚举值 [英] List Enum values in dropdown php mysql

查看:58
本文介绍了列出下拉式PHP MySQL中的枚举值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含以下列的mysql表.

I have a mysql table which contains following cols.

 Id     Name      Sex

和性别"列具有枚举类型(男",女",未指定")

and sex column have type of enum('Male','Female','Unspecified')

我如何在下拉列表中列出枚举值并使当前存储的值处于选定状态

How can i list enum values in a dropdown and make current stored value as selected

推荐答案

检查此链接...非常棒..该脚本可用于任何枚举列:

Check this link...its pretty awesome..the script is reusable for any enum column:

http: //jadendreamer.wordpress.com/2011/03/16/php-tutorial-put-mysql-enum-values-into-drop-down-select-box/

这篇关于列出下拉式PHP MySQL中的枚举值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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