[PHP] mysql_field_type() ...

2003-11-03 Thread René Fournier
...will say if a field is of type ENUM, but not its possible values 
(including default). Does anyone know how I can fetch possible values 
of a field type of ENUM?

Thanks.

...Rene

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] mysql_field_type() ...

2003-11-03 Thread Jay Blanchard
[snip]
...will say if a field is of type ENUM, but not its possible values 
(including default). Does anyone know how I can fetch possible values 
of a field type of ENUM?
[/snip]

You would have to use DESCRIBE. So if

DESCRIBE db; //in the mysql table

returns --

+-+-+--+-+-+---+
| Field   | Type| Null | Key | Default | Extra |
+-+-+--+-+-+---+
| Host| char(60) binary |  | PRI | |   |
| Db  | char(64) binary |  | PRI | |   |
| User| char(16) binary |  | PRI | |   |
| Select_priv | enum('N','Y')   |  | | N   |   |
| Insert_priv | enum('N','Y')   |  | | N   |   |
| Update_priv | enum('N','Y')   |  | | N   |   |
| Delete_priv | enum('N','Y')   |  | | N   |   |
| Create_priv | enum('N','Y')   |  | | N   |   |
| Drop_priv   | enum('N','Y')   |  | | N   |   |
| Grant_priv  | enum('N','Y')   |  | | N   |   |
| References_priv | enum('N','Y')   |  | | N   |   |
| Index_priv  | enum('N','Y')   |  | | N   |   |
| Alter_priv  | enum('N','Y')   |  | | N   |   |
+-+-+--+-+-+---+

you can get the info from the `Type` column

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mysql_field_type() ...

2003-11-03 Thread John W. Holmes
Jay Blanchard wrote:

[snip]
...will say if a field is of type ENUM, but not its possible values 
(including default). Does anyone know how I can fetch possible values 
of a field type of ENUM?
[/snip]

You would have to use DESCRIBE. So if
Even better is

DESC table_name column_name;

so you only have to parse one row (if you're only after one row). :)

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php