如何查询PHP数据库中所有表的名称?

2026-04-05 14:581阅读0评论SEO资讯
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计127个文字,预计阅读时间需要1分钟。

如何查询PHP数据库中所有表的名称?

php$conn=@mysql_connect(localhost, userName, password) or die(Sorry - could not connect to MySQL);$rs1=mysql_list_dbs($conn);for ($row=0; $row

如何查询PHP数据库中所有表的名称?

<?php $conn = @mysql_connect( "localhost", "userName", "password" ) or die( "Sorry - could not connect to MySQL" );$rs1= mysql_list_dbs( $conn );for( $row=0; $row < mysql_num_rows( $rs1 ); $row++ ) { $this_db = mysql_tablename( $rs1, $row ); $list .= "<b>".$this_db."</b><br />"; if( $this_db != "mysql" ) { $rs2 = mysql_list_tables( $this_db ); for( $num=0; $num < mysql_num_rows( $rs2) ; $num++ ) { $list .= " - " . mysql_tablename( $rs2, $num ) . "<br />"; } } } ?> <html> <head> <title>Listing Tables</title> </head> <body> <?php echo( $list ); ?> </body></html>

本文共计127个文字,预计阅读时间需要1分钟。

如何查询PHP数据库中所有表的名称?

php$conn=@mysql_connect(localhost, userName, password) or die(Sorry - could not connect to MySQL);$rs1=mysql_list_dbs($conn);for ($row=0; $row

如何查询PHP数据库中所有表的名称?

<?php $conn = @mysql_connect( "localhost", "userName", "password" ) or die( "Sorry - could not connect to MySQL" );$rs1= mysql_list_dbs( $conn );for( $row=0; $row < mysql_num_rows( $rs1 ); $row++ ) { $this_db = mysql_tablename( $rs1, $row ); $list .= "<b>".$this_db."</b><br />"; if( $this_db != "mysql" ) { $rs2 = mysql_list_tables( $this_db ); for( $num=0; $num < mysql_num_rows( $rs2) ; $num++ ) { $list .= " - " . mysql_tablename( $rs2, $num ) . "<br />"; } } } ?> <html> <head> <title>Listing Tables</title> </head> <body> <?php echo( $list ); ?> </body></html>