Re: GETTING ENUM FIELD VALUES
| From: | Matthew Leingang | Date: | Tue, 10 Oct 2000 13:01:34 +0000 |
| Subject: | Re: GETTING ENUM FIELD VALUES | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-19328@lists.php.net to get a copy of this message | ||
Dear Last,
I'm not sure if this is what you want, but... If you want to find the
accepted values for an ENUM field, you can get that by sending a DESCRIBE
or SHOW query. Something like:
$result = mysql_query("SHOW COLUMNS FROM table LIKE 'approved'");
$col = mysql_fetch_array($result);
Then $col['type'] is the string "enum('approved','waiting
approved','not
approved')". You can extract that by
$approved_states = explode("(enum\()?'\)?",$col)
or something like that because I haven't tested it. But hopefully you get
the idea.
HTH,
Matt
----------------------------------------------------------------
Matthew Leingang http://www.math.rutgers.edu/
Rutgers University leingang@math.rutgers.edu
Department of Mathematics "This signature needs no quote."
On Mon, 9 Oct 2000, LAST JEDI wrote:
> Is there a way that you can get the values of an ENUM field using a PHP
> query?
>
>
> 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?
>
> Thanks
>
> --
> ----------
> Greetings Jedi - http://lastjedi.org
>
>
>
>
>
> [ Part 49: "Included Message" ]
>