0
我正在尝试使用函数mysqli_fetch_field()
来获取数据库中每个表的名称。但是,当我尝试使用$fieldInfo->table
输出表名称时,我得到了重复项。我怎样才能从每个表中只选择1列,以便$fieldInfo->table
不是针对每个表的每列调用的?PHP/SQL - 如何获取数据库中表的名称?
当前SQL:
$sql = "SELECT * from administrators, bookings, customers, rooms";
$results = mysqli_query($conn, $sql)
or die ('Problem with query' . mysqli_error($conn));
我的代码来显示在单选按钮表名:
<?php
while ($fieldInfo = mysqli_fetch_field($results)) {
?>
<input type="radio" name="tableNames" value="<?php echo $fieldInfo->table; ?>"> <?php echo $fieldInfo->table ?> <br>
<?php } ?>
'资源mysql_list_tables(字符串$数据库[,资源$ link_identifier = NULL])',[function.mysql一览tables.php](http://php.net/manual/en /function.mysql-list-tables.php) –
@FrayneKonok'mysqli'和'mysql'之间有区别... – arkascha
'SELECT 1 from administrative,bookings,customers,rooms'? – arkascha