Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f519582

Browse files
Merge pull request #11 from catruzz/patch-2
README change to match BuildParams change
2 parents 05bfe22 + 536f5f3 commit f519582

File tree

1 file changed

+32
-3
lines changed

1 file changed

+32
-3
lines changed

‎README.md

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ Array
7070
)
7171
```
7272

73-
#### WHERE IN:
73+
#### WHERE IN (needs named placeholder):
7474

7575
```php
7676
<?php
77-
$DB->query("SELECT * FROM fruit WHERE name IN (?)",array('apple','banana'));
77+
$DB->query("SELECT * FROM fruit WHERE name IN (:fruits)",array(array('apple','banana')));
7878
?>
7979
```
8080

@@ -98,11 +98,40 @@ Array
9898
)
9999
```
100100

101+
```php
102+
<?php
103+
$query = "SELECT * FROM fruit WHERE name IN (:fruits) AND color = :color";
104+
// use multidimensional array as $params
105+
$params = array(
106+
"color" => "red",
107+
"fruits" => array(
108+
"apple",
109+
"banana"
110+
)
111+
);
112+
$DB->query($query,$params);
113+
?>
114+
```
115+
116+
Result:
117+
118+
```php
119+
Array
120+
(
121+
[0] => Array
122+
(
123+
[id] => 1
124+
[name] => apple
125+
[color] => red
126+
)
127+
)
128+
```
129+
101130
#### Fetching Column:
102131

103132
```php
104133
<?php
105-
$DB->column("SELECT color FROM fruit WHERE name IN (?)",array('apple','banana','watermelon'));
134+
$DB->column("SELECT color FROM fruit WHERE name IN (:color)",array('apple','banana','watermelon'));
106135
?>
107136
```
108137

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /