reference/pdo/pdostatement/fetch.xml
daf4cc624df3c21d472149725feb377b1beedb04
...
...
@@ -69,7 +69,8 @@
69
69
<listitem><para>
70
70
<literal>PDO::FETCH_LAZY</literal>: combines
71
71
<literal>PDO::FETCH_BOTH</literal> and <literal>PDO::FETCH_OBJ</literal>,
72
-
creating the object variable names as they are accessed
72
+
and is returning a <classname>PDORow</classname> object
73
+
which is creating the object property names as they are accessed.
73
74
</para></listitem>
74
75
<listitem><para>
75
76
<literal>PDO::FETCH_NAMED</literal>: returns an array with the same
...
...
@@ -158,29 +159,29 @@ $sth = $dbh->prepare("SELECT name, colour FROM fruit");
158
159
$sth->execute();
159
160

160
161
/* Exercise PDOStatement::fetch styles */
161
-
print("PDO::FETCH_ASSOC: ");
162
-
print("Return next row as an array indexed by column name\n");
162
+
print "PDO::FETCH_ASSOC: ";
163
+
print "Return next row as an array indexed by column name\n";
163
164
$result = $sth->fetch(PDO::FETCH_ASSOC);
164
165
print_r($result);
165
-
print("\n");
166
+
print "\n";
166
167

167
-
print("PDO::FETCH_BOTH: ");
168
-
print("Return next row as an array indexed by both column name and number\n");
168
+
print "PDO::FETCH_BOTH: ";
169
+
print "Return next row as an array indexed by both column name and number\n";
169
170
$result = $sth->fetch(PDO::FETCH_BOTH);
170
171
print_r($result);
171
-
print("\n");
172
+
print "\n";
172
173

173
-
print("PDO::FETCH_LAZY: ");
174
-
print("Return next row as an anonymous object with column names as properties\n");
174
+
print "PDO::FETCH_LAZY: ";
175
+
print "Return next row as a PDORow object with column names as properties\n";
175
176
$result = $sth->fetch(PDO::FETCH_LAZY);
176
177
print_r($result);
177
-
print("\n");
178
+
print "\n";
178
179

179
-
print("PDO::FETCH_OBJ: ");
180
-
print("Return next row as an anonymous object with column names as properties\n");
180
+
print "PDO::FETCH_OBJ: ";
181
+
print "Return next row as an anonymous object with column names as properties\n";
181
182
$result = $sth->fetch(PDO::FETCH_OBJ);
182
183
print $result->name;
183
-
print("\n");
184
+
print "\n";
184
185
?>
185
186
]]>
186
187
</programlisting>
...
...
@@ -203,7 +204,7 @@ Array
203
204
[1] => yellow
204
205
)
205
206

206
-
PDO::FETCH_LAZY: Return next row as an anonymous object with column names as properties
207
+
PDO::FETCH_LAZY: Return next row as a PDORow object with column names as properties
207
208
PDORow Object
208
209
(
209
210
[name] => orange
210
211