Home  >  Article  >  php教程  >  PHP列出MySQL中所有数据库的方法

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

WBOY
WBOYOriginal
2016-06-06 20:06:511147browse

这篇文章主要介绍了PHP列出MySQL中所有数据库的方法,涉及php操作数据库的技巧,非常具有实用价值,需要的朋友可以参考下

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

PHP代码如下:

'.NL; ///* USING: mysql_fetch_object() // --------------------------- while( $row = mysql_fetch_object( $result ) ): echo TB.'

  • '.$row->Database.'
  • '.NL; endwhile; //*/ /* USING: mysql_fetch_row() // ------------------------ while( $row = mysql_fetch_row( $result ) ): echo TB.'
  • '.$row[0].'
  • '.NL; endwhile; //*/ /* USING: mysql_fetch_assoc() // -------------------------- while( $row = mysql_fetch_assoc( $result ) ): echo TB.'
  • '.$row['Database'].'
  • '.NL; endwhile; //*/ echo ''.NL; // Free resources / close MySQL Connection mysql_free_result( $result ); mysql_close( $conn ); ?>

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

    Statement:
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn