reference/mysqli/mysqli_result/fetch-row.xml
035c126c0393fe154bac46e2c3c489ebadce48a5
...
...
@@ -4,19 +4,19 @@
4
4
<refnamediv>
5
5
<refname>mysqli_result::fetch_row</refname>
6
6
<refname>mysqli_fetch_row</refname>
7
-
<refpurpose>Get a result row as an enumerated array</refpurpose>
7
+
<refpurpose>Fetch the next row of a result set as an enumerated array</refpurpose>
8
8
</refnamediv>
9
9

10
10
<refsect1 role="description">
11
11
&reftitle.description;
12
-
<para>Object oriented style (method):</para>
13
-
<methodsynopsis>
14
-
<type>mixed</type><methodname>mysqli_result::fetch_row</methodname>
15
-
<void />
12
+
<para>&style.oop;</para>
13
+
<methodsynopsis role="mysqli_result">
14
+
<modifier>public</modifier> <type class="union"><type>array</type><type>null</type><type>false</type></type><methodname>mysqli_result::fetch_row</methodname>
15
+
<void/>
16
16
</methodsynopsis>
17
-
<para>Procedural style:</para>
17
+
<para>&style.procedural;</para>
18
18
<methodsynopsis>
19
-
<type>mixed</type><methodname>mysqli_fetch_row</methodname>
19
+
<type class="union"><type>array</type><type>null</type><type>false</type></type><methodname>mysqli_fetch_row</methodname>
20
20
<methodparam><type>mysqli_result</type><parameter>result</parameter></methodparam>
21
21
</methodsynopsis>
22
22
<para>
...
...
@@ -25,6 +25,7 @@
25
25
Each subsequent call to this function will return the next row within the
26
26
result set, or &null; if there are no more rows.
27
27
</para>
28
+
&database.fetch-null;
28
29
</refsect1>
29
30

30
31
<refsect1 role="parameters">
...
...
@@ -39,80 +40,53 @@
39
40
<refsect1 role="returnvalues">
40
41
&reftitle.returnvalues;
41
42
<para>
42
-
<function>mysqli_fetch_row</function> returns an array of strings that corresponds to the fetched row
43
-
or &null; if there are no more rows in result set.
43
+
Returns an enumerated array representing the fetched row, &null; if there
44
+
are no more rows in the result set, &return.falseforfailure;.
44
45
</para>
45
-
&database.fetch-null;
46
46
</refsect1>
47
47

48
48
<refsect1 role="examples">
49
49
&reftitle.examples;
50
50
<example>
51
-
<title>Object oriented style</title>
51
+
<title><methodname>mysqli_result::fetch_row</methodname> example</title>
52
+
<para>&style.oop;</para>
52
53
<programlisting role="php">
53
54
<![CDATA[
54
55
<?php
55
-
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
56
56

57
-
/* check connection */
58
-
if (mysqli_connect_errno()) {
59
-
printf("Connect failed: %s\n", mysqli_connect_error());
60
-
exit();
61
-
}
62
-

63
-
$query = "SELECT Name, CountryCode FROM City ORDER by ID DESC LIMIT 50,5";
57
+
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
58
+
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
64
59

65
-
if ($result = $mysqli->query($query)) {
60
+
$query = "SELECT Name, CountryCode FROM City ORDER BY ID DESC";
66
61

67
-
/* fetch object array */
68
-
while ($row = $result->fetch_row()) {
69
-
printf ("%s (%s)\n", $row[0], $row[1]);
70
-
}
62
+
$result = $mysqli->query($query);
71
63

72
-
/* free result set */
73
-
$result->close();
64
+
/* fetch object array */
65
+
while ($row = $result->fetch_row()) {
66
+
printf("%s (%s)\n", $row[0], $row[1]);
74
67
}
75
-

76
-
/* close connection */
77
-
$mysqli->close();
78
-
?>
79
68
]]>
80
-
</programlisting>
81
-
</example>
82
-
<example>
83
-
<title>Procedural style</title>
69
+
</programlisting>
70
+
<para>&style.procedural;</para>
84
71
<programlisting role="php">
85
72
<![CDATA[
86
73
<?php
87
-
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
88
-

89
-
/* check connection */
90
-
if (mysqli_connect_errno()) {
91
-
printf("Connect failed: %s\n", mysqli_connect_error());
92
-
exit();
93
-
}
94
74

95
-
$query = "SELECT Name, CountryCode FROM City ORDER by ID DESC LIMIT 50,5";
75
+
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
76
+
$mysqli = mysqli_connect("localhost", "my_user", "my_password", "world");
96
77

97
-
if ($result = mysqli_query($link, $query)) {
78
+
$query = "SELECT Name, CountryCode FROM City ORDER BY ID DESC";
98
79

99
-
/* fetch associative array */
100
-
while ($row = mysqli_fetch_row($result)) {
101
-
printf ("%s (%s)\n", $row[0], $row[1]);
102
-
}
80
+
$result = mysqli_query($mysqli, $query);
103
81

104
-
/* free result set */
105
-
mysqli_free_result($result);
82
+
/* fetch associative array */
83
+
while ($row = mysqli_fetch_row($result)) {
84
+
printf("%s (%s)\n", $row[0], $row[1]);
106
85
}
107
-

108
-
/* close connection */
109
-
mysqli_close($link);
110
-
?>
111
86
]]>
112
87
</programlisting>
113
-
</example>
114
-
&example.outputs;
115
-
<screen>
88
+
&examples.outputs.similar;
89
+
<screen>
116
90
<![CDATA[
117
91
Pueblo (USA)
118
92
Arvada (USA)
...
...
@@ -120,7 +94,8 @@ Cape Coral (USA)
120
94
Green Bay (USA)
121
95
Santa Clara (USA)
122
96
]]>
123
-
</screen>
97
+
</screen>
98
+
</example>
124
99
</refsect1>
125
100

126
101
<refsect1 role="seealso">
...
...
@@ -129,6 +104,7 @@ Santa Clara (USA)
129
104
<simplelist>
130
105
<member><function>mysqli_fetch_array</function></member>
131
106
<member><function>mysqli_fetch_assoc</function></member>
107
+
<member><function>mysqli_fetch_column</function></member>
132
108
<member><function>mysqli_fetch_object</function></member>
133
109
<member><function>mysqli_query</function></member>
134
110
<member><function>mysqli_data_seek</function></member>
...
...
@@ -137,7 +113,6 @@ Santa Clara (USA)
137
113
</refsect1>
138
114

139
115
</refentry>
140
-

141
116
<!-- Keep this comment at the end of the file
142
117
Local variables:
143
118
mode: sgml
144
119