gpt4 book ai didi

mysql - 显示我的数据库中的所有表,但只有一个?

转载 作者:行者123 更新时间:2023-11-29 08:25:42 24 4
gpt4 key购买 nike

我想显示数据库中的所有表,但只有一个 .现在我知道最明显的方法如下:

<?php
$query = "SHOW TABLES";
$result= mysql_query($query ) or exit(mysql_error());
while ($row = mysql_fetch_row($result)) {
if ($row[0] != 'THE UNWANTED TABLE NAME') {
echo '<option value="'.$row[0].'">'.$row[0].'</option>';
}
}
?>

我的问题:有没有办法仅通过查询来做到这一点,如下所示:

$query = "show tables where 'condition to exclude the unwanted table' " 

谢谢

最佳答案

 SHOW TABLES 
FROM mydatabase
WHERE Tables_in_mydatabase != 'THE UNWANTED TABLE NAME';

See more about SHOW TABLES; syntax here.

mydatabase 替换为您的数据库名称。

关于mysql - 显示我的数据库中的所有表,但只有一个?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18011982/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com