gpt4 book ai didi

php - 使用 php 从数据库中选择表

转载 作者:太空宇宙 更新时间:2023-11-03 11:57:12 25 4
gpt4 key购买 nike

我有下面的代码来显示我数据库中所有表的列表。

$table_count = mysql_query("
SELECT TABLE_NAME
FROM information_schema.tables
WHERE table_schema = 'DB_NAME'
");
$tables = array();
while($row = mysql_fetch_array($table_count))
{
$table = $row["TABLE_NAME"];
}

是否可以更改此查询以显示除某些表之外的所有表?

如果可以,有人可以解释/告诉我怎么做吗?

最佳答案

当然可以。您可以选择一些列

SELECT foo, bar, baz from ...

或者您指定 where not 通过使用 ANDOR

链接您的条件
$table_count = mysql_query("
SELECT TABLE_NAME AS tableName, another_complicated_column as niceName
FROM information_schema.tables
WHERE table_schema = 'DB_NAME'
AND another_column NOT LIKE 'FOOBARBAZ'
AND another_another_column != 333
");

关于php - 使用 php 从数据库中选择表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31792631/

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