mirror of
https://github.com/php/doc-ru.git
synced 2025-07-28 06:39:58 +00:00
165 lines
4.3 KiB
XML
165 lines
4.3 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
||
<!-- EN-Revision: e41806c30bf6975e452c0d4ce35ab0984c2fa68c Maintainer: shein Status: ready -->
|
||
<!-- Reviewed: no -->
|
||
<refentry xml:id="function.mysql-list-fields" xmlns="http://docbook.org/ns/docbook">
|
||
<refnamediv>
|
||
<refname>mysql_list_fields</refname>
|
||
<refpurpose>Возвращает список колонок таблицы</refpurpose>
|
||
</refnamediv>
|
||
|
||
<refsynopsisdiv>
|
||
<warning>
|
||
&mysql.alternative.note.5-4-0;
|
||
<simplelist role="alternatives">
|
||
<member>SQL запрос: <literal>SHOW COLUMNS FROM sometable</literal></member>
|
||
</simplelist>
|
||
</warning>
|
||
</refsynopsisdiv>
|
||
|
||
<refsect1 role="description">
|
||
&reftitle.description;
|
||
<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><initializer>NULL</initializer></methodparam>
|
||
</methodsynopsis>
|
||
<para>
|
||
Возвращает информацию о таблице с переданным именем.
|
||
</para>
|
||
<para>
|
||
Эта функция устарела. Вместо неё рекомендуется использовать
|
||
<function>mysql_query</function> с SQL-запросом
|
||
<literal>SHOW COLUMNS FROM table [LIKE 'name']</literal>.
|
||
</para>
|
||
</refsect1>
|
||
|
||
<refsect1 role="parameters">
|
||
&reftitle.parameters;
|
||
<para>
|
||
<variablelist>
|
||
<varlistentry>
|
||
<term><parameter>database_name</parameter></term>
|
||
<listitem>
|
||
<para>
|
||
Имя опрашиваемой базы данных.
|
||
</para>
|
||
</listitem>
|
||
</varlistentry>
|
||
<varlistentry>
|
||
<term><parameter>table_name</parameter></term>
|
||
<listitem>
|
||
<para>
|
||
Имя опрашиваемой таблицы.
|
||
</para>
|
||
</listitem>
|
||
</varlistentry>
|
||
&mysql.linkid.description;
|
||
</variablelist>
|
||
</para>
|
||
</refsect1>
|
||
|
||
<refsect1 role="returnvalues">
|
||
&reftitle.returnvalues;
|
||
<para>
|
||
Дескриптор результата (<type>resource</type>) в случае успешного выполнения,
|
||
или &false; в случае возникновения ошибки.
|
||
</para>
|
||
<para>
|
||
Возвращаемый результат может быть обработан с помощью следующих
|
||
функций: <function>mysql_field_flags</function>,
|
||
<function>mysql_field_len</function>,
|
||
<function>mysql_field_name</function>&listendand;
|
||
<function>mysql_field_type</function>.
|
||
</para>
|
||
</refsect1>
|
||
|
||
<refsect1 role="examples">
|
||
&reftitle.examples;
|
||
<para>
|
||
<example>
|
||
<title>Пример использования <function>mysql_list_fields</function></title>
|
||
<programlisting role="php">
|
||
<![CDATA[
|
||
<?php
|
||
$result = mysql_query("SHOW COLUMNS FROM sometable");
|
||
if (!$result) {
|
||
echo 'Ошибка при выполнении запроса: ' . mysql_error();
|
||
exit;
|
||
}
|
||
if (mysql_num_rows($result) > 0) {
|
||
while ($row = mysql_fetch_assoc($result)) {
|
||
print_r($row);
|
||
}
|
||
}
|
||
?>
|
||
]]>
|
||
</programlisting>
|
||
&example.outputs.similar;
|
||
<screen>
|
||
<![CDATA[
|
||
Array
|
||
(
|
||
[Field] => id
|
||
[Type] => int(7)
|
||
[Null] =>
|
||
[Key] => PRI
|
||
[Default] =>
|
||
[Extra] => auto_increment
|
||
)
|
||
Array
|
||
(
|
||
[Field] => email
|
||
[Type] => varchar(100)
|
||
[Null] =>
|
||
[Key] =>
|
||
[Default] =>
|
||
[Extra] =>
|
||
)
|
||
]]>
|
||
</screen>
|
||
</example>
|
||
</para>
|
||
</refsect1>
|
||
|
||
<refsect1 role="notes">
|
||
&reftitle.notes;
|
||
<note>
|
||
<para>
|
||
&info.deprecated.alias;
|
||
<function>mysql_listfields</function>
|
||
</para>
|
||
</note>
|
||
</refsect1>
|
||
|
||
<refsect1 role="seealso">
|
||
&reftitle.seealso;
|
||
<para>
|
||
<simplelist>
|
||
<member><function>mysql_field_flags</function></member>
|
||
<member><function>mysql_info</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
|
||
-->
|