📜  在 php 中显示 MySQL 数据库中的所有表名 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:10.833000             🧑  作者: Mango

代码示例1
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "dbms";

$conn = new mysqli($servername, $username, $password, $dbname);
$sql = "show tables LIKE '%student%'";

$result = mysqli_query($conn, $sql); // run the query and assign the result to $result
while($table = mysqli_fetch_array($result)) { // go through each row that was returned in $result
    echo($table[0] . "
"); // print the table that was returned on that row. }