reference/mysqli/mysqli_stmt/data-seek.xml
51c34024efa35d5691825b3e61037ffe61c46d20
...
...
@@ -4,26 +4,28 @@
4
4
<refnamediv>
5
5
<refname>mysqli_stmt::data_seek</refname>
6
6
<refname>mysqli_stmt_data_seek</refname>
7
-
<refpurpose>Seeks to an arbitrary row in statement result set</refpurpose>
7
+
<refpurpose>Adjusts the result pointer to an arbitrary row in the buffered result</refpurpose>
8
8
</refnamediv>
9
9

10
10
<refsect1 role="description">
11
11
&reftitle.description;
12
12
<para>&style.oop;</para>
13
-
<methodsynopsis role="oop">
14
-
<type>void</type><methodname>mysqli_stmt::data_seek</methodname>
13
+
<methodsynopsis role="mysqli_stmt">
14
+
<modifier>public</modifier> <type>void</type><methodname>mysqli_stmt::data_seek</methodname>
15
15
<methodparam><type>int</type><parameter>offset</parameter></methodparam>
16
16
</methodsynopsis>
17
17
<para>&style.procedural;</para>
18
18
<methodsynopsis>
19
19
<type>void</type><methodname>mysqli_stmt_data_seek</methodname>
20
-
<methodparam><type>mysqli_stmt</type><parameter>stmt</parameter></methodparam>
20
+
<methodparam><type>mysqli_stmt</type><parameter>statement</parameter></methodparam>
21
21
<methodparam><type>int</type><parameter>offset</parameter></methodparam>
22
22
</methodsynopsis>
23
23
<para>
24
-
Seeks to an arbitrary result pointer in the statement result set.
24
+
This function moves the result set pointer of the buffered result set to
25
+
an arbitrary row specified by the <parameter>offset</parameter> parameter.
25
26
</para>
26
27
<para>
28
+
This function works only on the buffered internal result set.
27
29
<function>mysqli_stmt_store_result</function> must be called prior to
28
30
<function>mysqli_stmt_data_seek</function>.
29
31
</para>
...
...
@@ -61,42 +63,24 @@
61
63
<programlisting role="php">
62
64
<![CDATA[
63
65
<?php
64
-
/* Open a connection */
65
-
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
66
66

67
-
/* check connection */
68
-
if (mysqli_connect_errno()) {
69
-
printf("Connect failed: %s\n", mysqli_connect_error());
70
-
exit();
71
-
}
67
+
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
68
+
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
72
69

73
70
$query = "SELECT Name, CountryCode FROM City ORDER BY Name";
74
-
if ($stmt = $mysqli->prepare($query)) {
75
-

76
-
/* execute query */
77
-
$stmt->execute();
78
-

79
-
/* bind result variables */
80
-
$stmt->bind_result($name, $code);
81
-

82
-
/* store result */
83
-
$stmt->store_result();
71
+
$stmt = $mysqli->prepare($query);
72
+
$stmt->execute();
84
73

85
-
/* seek to row no. 400 */
86
-
$stmt->data_seek(399);
74
+
$stmt->bind_result($name, $code);
87
75

88
-
/* fetch values */
89
-
$stmt->fetch();
76
+
$stmt->store_result();
90
77

91
-
printf ("City: %s Countrycode: %s\n", $name, $code);
78
+
/* seek to row no. 400 */
79
+
$stmt->data_seek(399);
92
80

93
-
/* close statement */
94
-
$stmt->close();
95
-
}
81
+
$stmt->fetch();
96
82

97
-
/* close connection */
98
-
$mysqli->close();
99
-
?>
83
+
printf("City: %s Countrycode: %s\n", $name, $code);
100
84
]]>
101
85
</programlisting>
102
86
</example>
...
...
@@ -105,42 +89,25 @@ $mysqli->close();
105
89
<programlisting role="php">
106
90
<![CDATA[
107
91
<?php
108
-
/* Open a connection */
109
-
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
110
92

111
-
/* check connection */
112
-
if (mysqli_connect_errno()) {
113
-
printf("Connect failed: %s\n", mysqli_connect_error());
114
-
exit();
115
-
}
93
+
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
94
+
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
116
95

117
96
$query = "SELECT Name, CountryCode FROM City ORDER BY Name";
118
-
if ($stmt = mysqli_prepare($link, $query)) {
119
-

120
-
/* execute query */
121
-
mysqli_stmt_execute($stmt);
97
+
$stmt = mysqli_prepare($link, $query);
122
98

123
-
/* bind result variables */
124
-
mysqli_stmt_bind_result($stmt, $name, $code);
99
+
mysqli_stmt_execute($stmt);
125
100

126
-
/* store result */
127
-
mysqli_stmt_store_result($stmt);
101
+
mysqli_stmt_bind_result($stmt, $name, $code);
128
102

129
-
/* seek to row no. 400 */
130
-
mysqli_stmt_data_seek($stmt, 399);
103
+
mysqli_stmt_store_result($stmt);
131
104

132
-
/* fetch values */
133
-
mysqli_stmt_fetch($stmt);
105
+
/* seek to row no. 400 */
106
+
mysqli_stmt_data_seek($stmt, 399);
134
107

135
-
printf ("City: %s Countrycode: %s\n", $name, $code);
108
+
mysqli_stmt_fetch($stmt);
136
109

137
-
/* close statement */
138
-
mysqli_stmt_close($stmt);
139
-
}
140
-

141
-
/* close connection */
142
-
mysqli_close($link);
143
-
?>
110
+
printf("City: %s Countrycode: %s\n", $name, $code);
144
111
]]>
145
112
</programlisting>
146
113
&examples.outputs;
...
...
@@ -157,12 +124,14 @@ City: Benin City Countrycode: NGA
157
124
<para>
158
125
<simplelist>
159
126
<member><function>mysqli_prepare</function></member>
127
+
<member><function>mysqli_stmt_store_result</function></member>
128
+
<member><function>mysqli_stmt_num_rows</function></member>
129
+
<member><function>mysqli_data_seek</function></member>
160
130
</simplelist>
161
131
</para>
162
132
</refsect1>
163
133

164
134
</refentry>
165
-

166
135
<!-- Keep this comment at the end of the file
167
136
Local variables:
168
137
mode: sgml
169
138