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
a77650ba
Commit
a77650ba
authored
Jan 21, 2015
by
alexbs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update db-dao.md
There is no queryRow! There must be queryOne in Yii2 am i right?!
parent
bab2737f
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 @
a77650ba
...
@@ -190,8 +190,8 @@ executing it multiple times with different parameters. For example,
...
@@ -190,8 +190,8 @@ executing it multiple times with different parameters. For example,
```
php
```
php
$command
=
$db
->
createCommand
(
'SELECT * FROM post WHERE id=:id'
);
$command
=
$db
->
createCommand
(
'SELECT * FROM post WHERE id=:id'
);
$post1
=
$command
->
bindValue
(
':id'
,
1
)
->
query
Row
();
$post1
=
$command
->
bindValue
(
':id'
,
1
)
->
query
One
();
$post2
=
$command
->
bindValue
(
':id'
,
2
)
->
query
Row
();
$post2
=
$command
->
bindValue
(
':id'
,
2
)
->
query
One
();
```
```
Because
[
[yii\db\Command::bindParam()|bindParam()
]
] supports binding parameters by references, the above code
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')
...
@@ -202,10 +202,10 @@ $command = $db->createCommand('SELECT * FROM post WHERE id=:id')
->
bindParam
(
':id'
,
$id
);
->
bindParam
(
':id'
,
$id
);
$id
=
1
;
$id
=
1
;
$post1
=
$command
->
query
Row
();
$post1
=
$command
->
query
One
();
$id
=
2
;
$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
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