[PHP] 列出表 php列出数据库中的所有表 →→→→→进入此内容的聊天室

来自 , 2020-01-22, 写在 PHP, 查看 128 次.
URL http://www.code666.cn/view/d9b1655c
  1. <?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++ )
  2. {
  3.   $this_db = mysql_tablename( $rs1, $row );
  4.   $list .= "<b>".$this_db."</b><br />";
  5.   if( $this_db != "mysql" )
  6.   {
  7.     $rs2 = mysql_list_tables( $this_db );
  8.  
  9.     for( $num=0; $num < mysql_num_rows( $rs2) ; $num++ )
  10.     {
  11.       $list .= " - " . mysql_tablename( $rs2, $num ) . "<br />";
  12.     }
  13.   }
  14. }
  15. ?>
  16.  
  17. <html> <head>
  18.   <title>Listing Tables</title>
  19.  </head> <body>
  20.   <?php  echo( $list ); ?>
  21.  </body></html>
  22.  
  23.  

回复 "列出表 php列出数据库中的所有表"

这儿你可以回复上面这条便签

captcha