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
bb78fca0
Commit
bb78fca0
authored
Dec 04, 2014
by
Nobuo Kihara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs/guide/db-query-builder.md - small fix [ci skip]
parent
fefd3d9b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
db-query-builder.md
docs/guide/db-query-builder.md
+4
-3
No files found.
docs/guide/db-query-builder.md
View file @
bb78fca0
...
...
@@ -261,8 +261,9 @@ Operator can be one of the following (see also [[yii\db\QueryInterface::where()]
Additionally you can specify anything as operator:
```
php
$userQuery
=
(
new
Query
)
->
select
(
'id'
)
->
from
(
'user'
);
$query
->
where
([
'>='
,
'id'
,
10
]);
$query
->
select
(
'id'
)
->
from
(
'user'
)
->
where
([
'>='
,
'id'
,
10
]);
```
It will result in:
...
...
@@ -294,7 +295,7 @@ WHERE (`status` = 10) AND (`title` LIKE '%yii%')
When building filter conditions based on user inputs, you usually want to specially handle "empty inputs"
by ignoring them in the filters. For example, you have an HTML form that takes username and email inputs.
If the user only enters something in the username input, you may want to build a query that only tries to
match the entered username. You may use the
`filterWhere()`
method achieve this goal:
match the entered username. You may use the
`filterWhere()`
method
to
achieve this goal:
```
php
// $username and $email are from user inputs
...
...
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