<?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.6 $ --> <!-- splitted from ./en/functions/mysql.xml, last change in rev 1.16 --> <refentry id="function.mysql-list-dbs"> <refnamediv> <refname>mysql_list_dbs</refname> <refpurpose> List databases available on a MySQL server </refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>resource</type><methodname>mysql_list_dbs</methodname> <methodparam choice="opt"><type>resource</type><parameter> link_identifier </parameter></methodparam> </methodsynopsis> <para> <function>mysql_list_dbs</function> will return a result pointer containing the databases available from the current mysql daemon. Use the <function>mysql_tablename</function> function to traverse this result pointer, or any function for result tables, such as <function>mysql_fetch_array</function>. </para> <para> <example> <title><function>mysql_list_dbs</function> example</title> <programlisting role="php"> <![CDATA[ <?php $link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); $db_list = mysql_list_dbs($link); while ($row = mysql_fetch_object($db_list)) { echo $row->Database . "\n"; } ?> ]]> </programlisting> <para> The above example would produce the following output: </para> <screen> <![CDATA[ database1 database2 database3 ... ]]> </screen> </example> </para> <note> <para> The above code would just as easily work with <function>mysql_fetch_row</function> or other similar functions. </para> </note> <para> For downward compatibility <function>mysql_listdbs</function> can also be used. This is deprecated however. </para> <para> See also <function>mysql_db_name</function>, and <function>mysql_select_db</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->