PHP列出MySQL中所有数据库的方法

前端之家收集整理的这篇文章主要介绍了PHP列出MySQL中所有数据库的方法前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

本文实例讲述了PHP列出@R_403_198@中所有数据库方法分享给大家供大家参考。具体如下:

PHP代码如下:

PHP;"> PHP define( 'NL',"\n" ); define( 'TB',' ' ); // connecting to @R_403_198@. $conn = @@R_403_198@_connect( 'localhost','username','password' ) or die( @R_403_198@_errno().': '.@R_403_198@_error().NL ); // attempt to get a list of @R_403_198@ databases // already set up in my account. This is done // using the PHP function: @R_403_198@_list_dbs() $result = @R_403_198@_list_dbs( $conn ); // Output the list echo '
    403_198@_fetch_object() // --------------------------- while( $row = @R_403_198@_fetch_object( $result ) ): echo TB.'
  • '.$row->Database.'
  • '.NL; endwhile; //*/ /* USING: @R_403_198@_fetch_row() // ------------------------ while( $row = @R_403_198@_fetch_row( $result ) ): echo TB.'
  • '.$row[0].'
  • '.NL; endwhile; //*/ /* USING: @R_403_198@_fetch_assoc() // -------------------------- while( $row = @R_403_198@_fetch_assoc( $result ) ): echo TB.'
  • '.$row['Database'].'
  • '.NL; endwhile; //*/ echo '
'.NL; // Free resources / close @R_403_198@ Connection @R_403_198@_free_result( $result ); @R_403_198@_close( $conn ); ?>

希望本文所述对大家的PHP程序设计有所帮助。

猜你在找的PHP相关文章