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 "$value<br>";

?>
<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

Reply via email to