reference/mysqli/mysqli_stmt/field-count.xml
7e5d0d1bb69180c9de1992edf9613215c975fa57
...
...
@@ -4,25 +4,102 @@
4
4
<refnamediv>
5
5
<refname>mysqli_stmt::$field_count</refname>
6
6
<refname>mysqli_stmt_field_count</refname>
7
-
<refpurpose>Returns the number of field in the given statement</refpurpose>
7
+
<refpurpose>Returns the number of columns in the given statement</refpurpose>
8
8
</refnamediv>
9
9

10
10
<refsect1 role="description">
11
11
&reftitle.description;
12
12
<para>&style.oop;</para>
13
-
<fieldsynopsis><type>int</type><varname linkend="mysqli-stmt.field-count">mysqli_stmt->field_count</varname></fieldsynopsis>
13
+
<fieldsynopsis><type>int</type><varname linkend="mysqli-stmt.field-count">mysqli_stmt-&gt;field_count</varname></fieldsynopsis>
14
14
<para>&style.procedural;</para>
15
15
<methodsynopsis>
16
16
<type>int</type><methodname>mysqli_stmt_field_count</methodname>
17
-
<methodparam><type>mysqli_stmt</type><parameter>stmt</parameter></methodparam>
17
+
<methodparam><type>mysqli_stmt</type><parameter>statement</parameter></methodparam>
18
18
</methodsynopsis>
19
+
<para>
20
+
Returns the number of columns in the prepared statement.
21
+
</para>
22
+
</refsect1>
19
23

20
-
&warn.undocumented.func;
24
+
<refsect1 role="parameters">
25
+
&reftitle.parameters;
26
+
<para>
27
+
<variablelist>
28
+
&mysqli.stmt.description;
29
+
</variablelist>
30
+
</para>
31
+
</refsect1>
21
32

33
+
<refsect1 role="returnvalues">
34
+
&reftitle.returnvalues;
35
+
<para>
36
+
Returns an integer representing the number of columns.
37
+
</para>
22
38
</refsect1>
23
39

24
-
</refentry>
40
+
<refsect1 role="examples">
41
+
&reftitle.examples;
42
+
<example>
43
+
<title>&style.oop;</title>
44
+
<programlisting role="php">
45
+
<![CDATA[
46
+
<?php
47
+

48
+
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
49
+
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
50
+

51
+
$code = 'FR';
52
+

53
+
$stmt = $mysqli->prepare("SELECT Name FROM Country WHERE Code=?");
54
+
$stmt->bind_param('s', $code);
55
+
$stmt->execute();
56
+
$row = $stmt->get_result()->fetch_row();
57
+
for ($i = 0; $i < $stmt->field_count; $i++) {
58
+
printf("Value of column number %d is %s", $i, $row[$i]);
59
+
}
60
+
]]>
61
+
</programlisting>
62
+
</example>
63
+
<example>
64
+
<title>&style.procedural;</title>
65
+
<programlisting role="php">
66
+
<![CDATA[
67
+
<?php
68
+

69
+
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
70
+
$mysqli = mysqli_connect("localhost", "my_user", "my_password", "world");
25
71

72
+
$code = 'FR';
73
+

74
+
$stmt = mysqli_prepare($mysqli, "SELECT Name FROM Country WHERE Code=?");
75
+
mysqli_stmt_bind_param($stmt, 's', $code);
76
+
mysqli_stmt_execute($stmt);
77
+
$result = mysqli_stmt_get_result($stmt);
78
+
$row = mysqli_fetch_row($result);
79
+
for ($i = 0; $i < mysqli_stmt_field_count($stmt); $i++) {
80
+
printf("Value of column number %d is %s", $i, $row[$i]);
81
+
}
82
+
]]>
83
+
</programlisting>
84
+
&examples.outputs.similar;
85
+
<screen>
86
+
<![CDATA[
87
+
Value of column number 0 is France
88
+
]]>
89
+
</screen>
90
+
</example>
91
+
</refsect1>
92
+

93
+
<refsect1 role="seealso">
94
+
&reftitle.seealso;
95
+
<para>
96
+
<simplelist>
97
+
<member><function>mysqli_stmt_num_rows</function></member>
98
+
</simplelist>
99
+
</para>
100
+
</refsect1>
101
+

102
+
</refentry>
26
103
<!-- Keep this comment at the end of the file
27
104
Local variables:
28
105
mode: sgml
29
106