php-doc-en/reference/mysql/functions/mysql-list-fields.xml
Mehdi Achour ee41772bf8 wrong description
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@127532 c90b9560-bf6c-de11-be94-00142212c4b1
2003-05-17 21:19:41 +00:00

87 lines
2.6 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-list-fields">
<refnamediv>
<refname>mysql_list_fields</refname>
<refpurpose>List MySQL table fields</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>resource</type><methodname>mysql_list_fields</methodname>
<methodparam><type>string</type><parameter>database_name</parameter></methodparam>
<methodparam><type>string</type><parameter>table_name</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_list_fields</function> retrieves information
about the given table name. Arguments are the database and
the table name. A result pointer is returned which can be used
with <function>mysql_field_flags</function>,
<function>mysql_field_len</function>,
<function>mysql_field_name</function>, and
<function>mysql_field_type</function>.
</para>
<para>
<example>
<title><function>mysql_list_fields</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
$fields = mysql_list_fields("database1", "table1", $link);
$columns = mysql_num_fields($fields);
for ($i = 0; $i < $columns; $i++) {
echo mysql_field_name($fields, $i) . "\n";
}
]]>
</programlisting>
<para>
The above example would produce the following output:
<screen>
<![CDATA[
field1
field2
field3
...
]]>
</screen>
</para>
</example>
</para>
<para>
For downward compatibility <function>mysql_listfields</function>
can also be used. This is deprecated however.
</para>
<!-- TODO: this is equiv. with 'select * from $table where &false;,'
which implies you can better use the field-research functions
on a real query, that saves you one mysql-query.
-->
</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
-->