-
Notifications
You must be signed in to change notification settings - Fork 109
Expand file tree
/
Copy pathmysql-list-fields.xml
More file actions
155 lines (148 loc) · 3.83 KB
/
Copy pathmysql-list-fields.xml
File metadata and controls
155 lines (148 loc) · 3.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 15d88bef8b9082fb92a3753a9e7551f9cf1836d3 Maintainer: dallas Status: ready -->
<!-- CREDITS: mowangjuanzi -->
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.mysql-list-fields">
<refnamediv>
<refname>mysql_list_fields</refname>
<refpurpose>列出 MySQL 表字段</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>
<simpara>
检索指定表名的信息。
</simpara>
<simpara>
此函数已弃用。最好使用 <function>mysql_query</function> 发出 SQL <literal>SHOW COLUMNS FROM
table [LIKE 'name']</literal> 语句代替。
</simpara>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>database_name</parameter></term>
<listitem>
<simpara>
The name of the database that's being queried.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>table_name</parameter></term>
<listitem>
<simpara>
The name of the table that's being queried.
</simpara>
</listitem>
</varlistentry>
&mysql.linkid.description;
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<simpara>
A result pointer <type>resource</type> on success, or &false; on
failure.
</simpara>
<simpara>
结果指针,可以用于 <function>mysql_field_flags</function>、<function>mysql_field_len</function>、<function>mysql_field_name</function> &listendand;
<function>mysql_field_type</function>。
</simpara>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title>替代弃用 <function>mysql_list_fields</function></title>
<programlisting role="php">
<![CDATA[
<?php
$result = mysql_query("SHOW COLUMNS FROM sometable");
if (!$result) {
echo 'Could not run query: ' . 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>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<note>
<simpara>
&info.deprecated.alias;
<function>mysql_listfields</function>
</simpara>
</note>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><function>mysql_field_flags</function></member>
<member><function>mysql_info</function></member>
</simplelist>
</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
-->