CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> Archive -> CodeChargeStudio.Discussion

 retrieve ENUM values out of MySQL?

Print topic Send  topic

Author Message
lukas rueegg
Posted: 10/08/2002, 10:35 AM

does anyone knows a way to retrieve ENUM values of a MySQL table for showing
them in a listbox?

======
CREATE TABLE `tabUser` (
`userID` int(11) NOT NULL auto_increment,
`nickname` varchar(25) default NULL,
`password` varchar(50) default NULL,
`firstname` varchar(25) default NULL,
`userlevel` varchar(20) default '20',
`name` varchar(25) default NULL,
`yob` year(4) default NULL,
`sex` enum('female','male') default NULL,
`mobile_device` enum('SMS','NOKIA 7650','SonyEricsson T68i') NOT NULL
default 'SMS',

=====

thanks

lukas.



BrentG
Posted: 10/18/2002, 11:04 AM

Lukas,
You will need to issue a query "show create table tabuser" and you will get
back 1 row of data with the create table command for this table. You then need
to parse the enum() into an include file. It isn't that difficult and can
probably be done fairly easily in PHP. You would only run it when you change
your ENUM's in the database.



lukas rueegg wrote:

> does anyone knows a way to retrieve ENUM values of a MySQL table for showing
> them in a listbox?
>
> ======
> CREATE TABLE `tabUser` (
> `userID` int(11) NOT NULL auto_increment,
> `nickname` varchar(25) default NULL,
> `password` varchar(50) default NULL,
> `firstname` varchar(25) default NULL,
> `userlevel` varchar(20) default '20',
> `name` varchar(25) default NULL,
> `yob` year(4) default NULL,
> `sex` enum('female','male') default NULL,
> `mobile_device` enum('SMS','NOKIA 7650','SonyEricsson T68i') NOT NULL
> default 'SMS',
>
> =====
>
> thanks
>
> lukas.
DonB
Posted: 10/19/2002, 6:31 AM

I think you'd be better off defining a lookup table containing the possible
values for 'mobile_device', then it's trivial to retrieve them. And that
would work correctly with a listbox control, too, which I assume is your
primary goal.

DonB


"lukas rueegg" <lru_ccs@pixworx.ch> wrote in message
news:anv513$mus$1@news.codecharge.com...
> does anyone knows a way to retrieve ENUM values of a MySQL table for
showing
> them in a listbox?
>
> ======
> CREATE TABLE `tabUser` (
> `userID` int(11) NOT NULL auto_increment,
> `nickname` varchar(25) default NULL,
> `password` varchar(50) default NULL,
> `firstname` varchar(25) default NULL,
> `userlevel` varchar(20) default '20',
> `name` varchar(25) default NULL,
> `yob` year(4) default NULL,
> `sex` enum('female','male') default NULL,
> `mobile_device` enum('SMS','NOKIA 7650','SonyEricsson T68i') NOT NULL
> default 'SMS',
>
> =====
>
> thanks
>
> lukas.
>
>
>
>


   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.