Re: GETTING ENUM FIELD VALUES

From: Date: Tue, 10 Oct 2000 08:15:02 +0000
Subject: Re: GETTING ENUM FIELD VALUES
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-19300@lists.php.net to get a copy of this message
At 7:17 PM -0400 10/9/00, Daniel Convissor <danielc@analysisandsolutions.com> wrote:
Hi Mystery person: For example, I have a table with a column called approved, it has an enum of approved, wating approved, and not approved. Is there a way I can dynamically get there enum values? Just use a normal query string: "select approved from table where .... etc ..." That'll return the text selected in the enum field. If you're looking to get the numeric index value of that text, I don't know of a way, perhaps someone else does. If you're looking to use the text value returned from the query to automatically select the appropriate value in the a list or radio box, then you'll need to rephrase your question to ask such. --Dan
I assume you're using MySQL? See http://www.mysql.com/documentation/mysql/commented/manual.php?section=DESCRIBE This is the command you'll need to get the values of the defined column ('approved', 'wating approved', and 'not approved' in your case). Just explode() or split() the returned value to get an array of the values. -steve +--- "They've got a cherry pie there, that'll kill ya" ------------------+
| Steve Edberg                           University of California, Davis |
| sbedberg@ucdavis.edu                               Computer Consultant |
| http://aesric.ucdavis.edu/                  http://pgfsun.ucdavis.edu/ |
+-------------------------------------- FBI Special Agent Dale Cooper ---+

« previous php.general (#19300) next »