我在php做这个代码,而选择任何数据库,它只显示表的数量,而不是所选数据库的所有表的名称


I am doing this code in php while selecting any database it only display the number of tables not the names of all tables of the selected database

<?php
    session_start();`enter code here`
    include 'dbconnect.php';
    $q=$_GET['q'];
    echo $field= "Tables_in_".$q;
    $sql = "SHOW TABLES FROM $q";
    $result= mysqli_query($conn,$sql);
     $new= array();
     $i=0;
    while ($row=mysqli_fetch_row($result)){
        echo $row['Tables_in_mysql'];
        $new[$i]=$row;
        $i++;
    }
    echo $num=count($new);
?>
<?php
    for($j=0;$j<$num;$j++){
        echo "here"; 
?>   
<?php echo $new[$j]['mysql']; ?>
<?php } ?>
<?php echo $q;?>
<?php
    session_start();`enter code here`
    include 'dbconnect.php';
    $q=$_GET['q'];
    echo $field= "Tables_in_".$q;
    $sql = "SHOW TABLES FROM $q";
    $result= mysqli_query($conn,$sql);
     $new= array();
     $i=0;
     while ($row=mysqli_fetch_row($result)){
        echo $row['Tables_in_mysql'];
        $new[$i]=$row;
        $i++;
    }
    echo $num=count($new);
?>
<?php for($j=0;$j<$num;$j++){      
    echo "here"; 
?>   

<?php echo $new[$j]['mysql'];   ?>
<?php } ?>
<?php echo $q;?>

这是我的代码,请帮助我打印在php中选择的数据库表的所有名称我已经通过show database命令显示了数据库的所有名称它以下拉菜单的形式显示当选择特定的数据库时它只显示其中的表数但我想显示表名

由于您没有发布任何代码,此答案可能不是您所追求的…但是这将显示当前数据库中的所有表。

select `table_name` as 'table' 
    from `information_schema`.`tables` 
    where `table_type`='base table' and `table_schema`=database();