File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -107,10 +107,9 @@ $stmt->execute();
107
107
<![CDATA[
108
108
<?php
109
109
$stmt = $dbh->prepare("SELECT * FROM REGISTRY where name = ?");
110
- if ($stmt->execute(array($_GET['name']))) {
111
- while ($row = $stmt->fetch()) {
112
- print_r($row);
113
- }
110
+ $stmt->execute([$_GET['name']]);
111
+ foreach ($stmt as $row) {
112
+ print_r($row);
114
113
}
115
114
?>
116
115
]]>
@@ -175,11 +174,11 @@ print "procedure returned $value\n";
175
174
<![CDATA[
176
175
<?php
177
176
$stmt = $dbh->prepare("SELECT * FROM REGISTRY where name LIKE '%?%'");
178
- $stmt->execute(array( $_GET['name']) );
177
+ $stmt->execute([ $_GET['name']] );
179
178
180
179
// placeholder must be used in the place of the whole value
181
180
$stmt = $dbh->prepare("SELECT * FROM REGISTRY where name LIKE ?");
182
- $stmt->execute(array( "%$_GET[name]%") );
181
+ $stmt->execute([ "%$_GET[name]%"] );
183
182
?>
184
183
]]>
185
184
</programlisting >
You can’t perform that action at this time.
0 commit comments