尝试从数据库中提取枚举值以存储在选择菜单php中

时间:2013-12-13 14:04:04

标签: php mysql

我正在尝试从数据库中提取枚举值,但是,我只是得到一个空的选择菜单。我可以得到一些帮助吗

<?php

include('connectdb.php');

$tableName = 'firefighterinfo';
$columnName = 'status';


echo "<select name=\"$columnName\">";
$result = mysql_query("SELECT 'ENUM' FROM `fbmsdatabase`.`firefighterinfo` WHERE `status`='$columnName'") or die (mysql_error());

$row = mysql_fetch_array($result);
$enumList = explode(",", str_replace("'", "", substr($row['ENUM'], 5, (strlen($row['ENUM'])-6))));

foreach($enumList as $value)
    echo '<option value="'.$value.'">'.$value.'</option>';

echo "</select>";

?>

<label for="Status">Status</label>
  <?php require_once('php/enum_status.php'); ?>

0 个答案:

没有答案