Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perl / mySQL enum

Status
Not open for further replies.

ogri

Programmer
Joined
Sep 26, 2000
Messages
74
Location
GB
Hi

Reading through a mySQL book I have found and want to use the enum data type. However is there a way to retrieve a list of possible values from the database (for example, to generate a drop down list box to select a value on an HTML form).

All the best

Keith
 
I'm probably going to tackle the same challenge myself sometime soon. I though about it a little this morning during my commute, and so I was surprised to see this posted since it is exactly a question I will need to answer. Here is my suggestion, and what I plan to do, run a "desc table;" query and then parse the second column of each returned row to build a data entry form in a table. I'm sure this is what you are doing? No? basically

if ( $ary[1] =~ /ENUM/i) {
($enums = $ary[1]) =~ s/.+\((.+)\).*?/$1/;

#now $enums contains just "option1","option2","etc..."
#and I can parse this to make the actual <select> html

}

I'll post my code when I'm done if you still need...

Hope this helps,

Jim

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top