php-doc-en/reference/mysql/functions/mysql-tablename.xml
Christoph Michael Becker b95d28e6ec Fix return types
Functions which return false on failure should state that in their
signature as well.


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@351135 c90b9560-bf6c-de11-be94-00142212c4b1
2020-11-02 15:52:35 +00:00

161 lines
4 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.mysql-tablename" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>mysql_tablename</refname>
<refpurpose>Get table name of field</refpurpose>
</refnamediv>
<refsynopsisdiv>
<warning>
&mysql.alternative.note;
<simplelist role="alternatives">
<member>SQL Query: <literal>SHOW TABLES</literal></member>
</simplelist>
</warning>
</refsynopsisdiv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type class="union"><type>string</type><type>false</type></type><methodname>mysql_tablename</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>i</parameter></methodparam>
</methodsynopsis>
<para>
Retrieves the table name from a <parameter>result</parameter>.
</para>
<para>
This function is deprecated. It is preferable to use
<function>mysql_query</function> to issue an SQL <literal>SHOW TABLES
[FROM db_name] [LIKE 'pattern']</literal> statement instead.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>result</parameter></term>
<listitem>
<para>
A result pointer <type>resource</type> that's returned from
<function>mysql_list_tables</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>i</parameter></term>
<listitem>
<para>
The integer index (row/table number)
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The name of the table on success&return.falseforfailure;.
</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="changelog">
&reftitle.changelog;
<para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>5.5.0</entry>
<entry>
The <function>mysql_tablename</function> function is deprecated,
and emits an <constant>E_DEPRECATED</constant> level error.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>mysql_tablename</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
mysql_connect("localhost", "mysql_user", "mysql_password");
$result = mysql_list_tables("mydb");
$num_rows = mysql_num_rows($result);
for ($i = 0; $i < $num_rows; $i++) {
echo "Table: ", mysql_tablename($result, $i), "\n";
}
mysql_free_result($result);
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<note>
<para>
The <function>mysql_num_rows</function> function may be used to
determine the number of tables in the result pointer.
</para>
</note>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>mysql_list_tables</function></member>
<member><function>mysql_field_table</function></member>
<member><function>mysql_db_name</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:"~/.phpdoc/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
-->