2002-04-15 00:12:54 +00:00
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
2005-03-30 06:27:14 +00:00
|
|
|
<!-- $Revision: 1.13 $ -->
|
2002-04-15 00:12:54 +00:00
|
|
|
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
|
2005-03-30 04:07:29 +00:00
|
|
|
<refentry id="function.mysql-tablename">
|
|
|
|
<refnamediv>
|
|
|
|
<refname>mysql_tablename</refname>
|
|
|
|
<refpurpose>Get table name of field</refpurpose>
|
|
|
|
</refnamediv>
|
|
|
|
<refsect1>
|
|
|
|
<title>Description</title>
|
2005-03-30 06:27:14 +00:00
|
|
|
<methodsynopsis>
|
|
|
|
<type>string</type><methodname>mysql_tablename</methodname>
|
|
|
|
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
|
|
|
|
<methodparam><type>int</type><parameter>i</parameter></methodparam>
|
|
|
|
</methodsynopsis>
|
2005-03-30 04:07:29 +00:00
|
|
|
<para>
|
|
|
|
<function>mysql_tablename</function> takes a result pointer
|
|
|
|
returned by the <function>mysql_list_tables</function> function
|
|
|
|
as well as an integer index and returns the name of a table. The
|
|
|
|
<function>mysql_num_rows</function> function may be used to
|
|
|
|
determine the number of tables in the result pointer.
|
|
|
|
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>.
|
|
|
|
<example>
|
|
|
|
<title><function>mysql_tablename</function> example</title>
|
|
|
|
<programlisting role="php">
|
2002-04-15 00:12:54 +00:00
|
|
|
<![CDATA[
|
|
|
|
<?php
|
2004-01-05 13:03:26 +00:00
|
|
|
mysql_connect("localhost", "mysql_user", "mysql_password");
|
|
|
|
$result = mysql_list_tables("mydb");
|
2004-08-01 22:57:56 +00:00
|
|
|
$num_rows = mysql_num_rows($result);
|
|
|
|
for ($i = 0; $i < $num_rows; $i++) {
|
2004-01-06 09:23:31 +00:00
|
|
|
echo "Table: ", mysql_tablename($result, $i), "\n";
|
|
|
|
}
|
2002-04-21 17:18:40 +00:00
|
|
|
|
2004-01-05 13:03:26 +00:00
|
|
|
mysql_free_result($result);
|
2002-04-15 00:12:54 +00:00
|
|
|
?>
|
|
|
|
]]>
|
2005-03-30 04:07:29 +00:00
|
|
|
</programlisting>
|
|
|
|
</example>
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
See also
|
|
|
|
<function>mysql_list_tables</function>,
|
|
|
|
<function>mysql_field_table</function>, and
|
|
|
|
<function>mysql_db_name</function>.
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
</refentry>
|
2002-04-15 00:12:54 +00:00
|
|
|
|
|
|
|
<!-- 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
|
|
|
|
-->
|