i 希望在数据库中填入一个表号的清单箱。 这部法律为之写,但似乎并未奏效。
<select id="arrays" name="arrays" style="width: 403px;" class="Fieldcell">
<?php
$dbname = myBase ;
if (!mysql_connect( localhost , root , )) {
echo Could not connect to mysql ;
exit;
}
$sql = "SHOW TABLES FROM $dbname";
$result = mysql_query($sql);
if (!$result) {
echo "DB Error, could not list tables
";
echo MySQL Error: . mysql_error();
exit;
}
$num_tables = mysql_num_rows($result);
for($i=0;$i<$num_tables;$i++)
{
echo "<option value="$row[i]">$row[i]</option>";
}
/*while ($row = mysql_fetch_row($result)) {
echo <option value="$row[0]">$row[0]</option>";
}*/
mysql_free_result($result);
?>
</select>