Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
d3134514
Commit
d3134514
authored
Jan 21, 2015
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6960 from alexbs/patch-1
Update db-dao.md
parents
bab2737f
a77650ba
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
db-dao.md
docs/guide/db-dao.md
+4
-4
No files found.
docs/guide/db-dao.md
View file @
d3134514
...
...
@@ -190,8 +190,8 @@ executing it multiple times with different parameters. For example,
```
php
$command
=
$db
->
createCommand
(
'SELECT * FROM post WHERE id=:id'
);
$post1
=
$command
->
bindValue
(
':id'
,
1
)
->
query
Row
();
$post2
=
$command
->
bindValue
(
':id'
,
2
)
->
query
Row
();
$post1
=
$command
->
bindValue
(
':id'
,
1
)
->
query
One
();
$post2
=
$command
->
bindValue
(
':id'
,
2
)
->
query
One
();
```
Because
[
[yii\db\Command::bindParam()|bindParam()
]
] supports binding parameters by references, the above code
...
...
@@ -202,10 +202,10 @@ $command = $db->createCommand('SELECT * FROM post WHERE id=:id')
->
bindParam
(
':id'
,
$id
);
$id
=
1
;
$post1
=
$command
->
query
Row
();
$post1
=
$command
->
query
One
();
$id
=
2
;
$post2
=
$command
->
query
Row
();
$post2
=
$command
->
query
One
();
```
Notice that you bind the placeholder to the
`$id`
variable before the execution, and then change the value of that variable
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment