[PHP-DB] mysql - enum

2002-12-02 Thread Bastian Vogt
Hi,

is it possible to get all possible values of an enum-field from a
mysql-table in php?
The values might be changed in the database. Now I've got an
select-field in my php-app where the user can select each value of the
enum-field for a new record befor saving...

Thanks for any reply,
Bastian


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




Re: [PHP-DB] mysql - enum

2002-12-02 Thread Ignatius Reilly
DESCRIBE tbl_name col_name 

Ignatius

- Original Message - 
From: Bastian Vogt [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, December 02, 2002 1:41 PM
Subject: [PHP-DB] mysql - enum


 Hi,
 
 is it possible to get all possible values of an enum-field from a
 mysql-table in php?
 The values might be changed in the database. Now I've got an
 select-field in my php-app where the user can select each value of the
 enum-field for a new record befor saving...
 
 Thanks for any reply,
 Bastian
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


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




Re: [PHP-DB] mysql - enum

2002-12-02 Thread Ruth Zhai
This is what I use:

SHOW COLUMNS FROM table LIKE field

I use the query result for a select field in HTML table.
Ruth
- Original Message - 
From: Bastian Vogt [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, December 02, 2002 11:41 PM
Subject: [PHP-DB] mysql - enum


 Hi,
 
 is it possible to get all possible values of an enum-field from a
 mysql-table in php?
 The values might be changed in the database. Now I've got an
 select-field in my php-app where the user can select each value of the
 enum-field for a new record befor saving...
 
 Thanks for any reply,
 Bastian
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 



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




[PHP-DB] MySQL enum displaying values in Select

2002-06-01 Thread bob

Hello,

I have a problem I can't seem to overcome. Maybe it's just something simple
but for some reason I am unable to read in values from a mysql db column
(enum) and display the results in an option box.

I can display the values to the screen but I can't seem to get them into the
option box. This is the snippet of code I've been struggling with... what am
I doing wrong? All I get in the option box is one value called 'Array' which
isn't even a value from my enum column.

Please let me know if you need more info.

Thanks for the help.

Rob.



(db connections strings here.)

$sql = SHOW COLUMNS FROM $table_name LIKE 'categories';
$result = mysql_query($sql);
$query_data = mysql_fetch_array($result);

if (eregi(('.*'), $query_data[Type], $match)) {
   $enum_str = ereg_replace(', , $match[1]);
   $enum_options = explode(',', $enum_str);
   }

array_push($enum_options, $query_data);
echo ENUM options with the default value:br;
foreach($enum_options as $value) echo $valuebr;

?
SELECT NAME=$categories size=5 multiple
SELECT NAME=member_groups[] size=5 multiple
option? echo $value; ?/option
/SELECT
?


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