mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-19 18:38:55 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@189750 c90b9560-bf6c-de11-be94-00142212c4b1
131 lines
3.1 KiB
XML
131 lines
3.1 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.17 $ -->
|
|
<refentry id="function.mysql-list-tables">
|
|
<refnamediv>
|
|
<refname>mysql_list_tables</refname>
|
|
<refpurpose>List tables in a MySQL database</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>resource</type><methodname>mysql_list_tables</methodname>
|
|
<methodparam><type>string</type><parameter>database</parameter></methodparam>
|
|
<methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Retrieves a list of table names from a MySQL database.
|
|
</para>
|
|
<para>
|
|
This function deprecated. It is preferable to use
|
|
<function>mysql_query</function> to issue a SQL <literal>SHOW TABLES
|
|
[FROM db_name] [LIKE 'pattern']</literal> statement instead.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>database</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The name of the database
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
&mysql.linkid.description;
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
A result pointer <type>resource</type> on success, or &false; on failure.
|
|
</para>
|
|
<para>
|
|
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>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title><function>mysql_list_tables</function> alternative example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$dbname = 'mysql_dbname';
|
|
|
|
if (!mysql_connect('mysql_host', 'mysql_user', 'mysql_password')) {
|
|
echo 'Could not connect to mysql';
|
|
exit;
|
|
}
|
|
|
|
$sql = "SHOW TABLES FROM $dbname";
|
|
$result = mysql_query($sql);
|
|
|
|
if (!$result) {
|
|
echo "DB Error, could not list tables\n";
|
|
echo 'MySQL Error: ' . mysql_error();
|
|
exit;
|
|
}
|
|
|
|
while ($row = mysql_fetch_row($result)) {
|
|
echo "Table: {$row[0]}\n";
|
|
}
|
|
|
|
mysql_free_result($result);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="notes">
|
|
&reftitle.notes;
|
|
<note>
|
|
<para>
|
|
&info.deprecated.alias;
|
|
<function>mysql_listtables</function>
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>mysql_list_dbs</function></member>
|
|
<member><function>mysql_tablename</function></member>
|
|
</simplelist>
|
|
</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
|
|
-->
|