当前位置 : 主页 > 网络编程 > PHP >

php列出mysql的所有数据库

来源:互联网 收集:自由互联 发布时间:2021-07-03
?php$conn = @mysql_connect( "localhost", "userName", "password" ) or die( "Sorry - could not connect to MySQL" );$rs= @mysql_list_dbs( $conn ) or die( "Sorry - could not list databases" );for( $row=0; $row mysql_num_rows($rs); $row++ ){ $db
<?php$conn = @mysql_connect( "localhost", "userName", "password" ) or die( "Sorry - could not connect to MySQL" );
$rs= @mysql_list_dbs( $conn ) or die( "Sorry - could not list databases" );for( $row=0; $row < mysql_num_rows($rs); $row++ ){
  $db_list .= mysql_tablename( $rs, $row ) . "<br />";  } ?><html> <head>
  <title>Listing databases</title>
 </head> <body>
  <h3>
   <?php echo( $db_list ); ?>
  </h3>
 </body></html>
网友评论