【问题标题】:Showing Results of MySQL SHOW tables On Website在网站上显示 MySQL SHOW 表的结果
【发布时间】:2016-01-22 05:23:09
【问题描述】:

我正在尝试在我的网站上显示数据库中的表列表,但我找不到在实际页面上显示SHOW tables 输出的方法。这是我的代码:

<?php
$servername = "localhost";
$username = "***";
$password = "***";
$dbname = "***";

//Create Connection

$conn = mysqli_connect($servername, $username, $password, $dbname);

//Check Connection

if (!$conn) {
        die("Connection failed: " .mysqli_connect_error());
}

$sql = "SHOW tables";

$result = mysqli_query($conn, $sql);

while ($row = mysqli_num_rows($result)) {
        echo $row[];
        }

mysqli_close($conn);

?>

【问题讨论】:

    标签: php mysql mysqli


    【解决方案1】:

    应该是,

    while($table = mysqli_fetch_array($result)) { 
        echo($table[0] . "<BR>");  
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多