[英]How to search SQL db for table names then echo all names
I would like to output the table names. 我想输出表名。 Getting error on line where while statement is.
while语句所在的行出现错误。
$queryTable = "SELECT * FROM 'db_name'.sys.tables";
$result = $con->query($queryTable);
while($table = mysql_fetch_array($result)) {
echo $table[0];
}
This is not mysql syntax. 这不是mysql语法。 There are two ways you can do it in mysql.
在mysql中有两种方法可以做到这一点。 First one is simply use
show tables
query. 第一个是简单地使用
show tables
查询。 this will give you all table names. 这将为您提供所有表名。 If you want more details, you can query
INFORMATION_SCHEMA.TABLES
table- in there you can get all details on the table (see more info here https://dev.mysql.com/doc/refman/5.0/en/tables-table.html ) 如果需要更多详细信息,可以查询
INFORMATION_SCHEMA.TABLES
-在其中可以获取该表的所有详细信息(在此处查看更多信息https://dev.mysql.com/doc/refman/5.0/en/tables-table .html )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.