Query Builder
Example Usage
# in config.php you can add the ff:
$config = [
// DATABASE
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'test',
'username' => 'root',
'password' => '',
'charset' => 'utf8',
'collation' => 'utf8_general_ci',
'prefix' => ''
// ...
];
$records = database()->table('users')
->select('id, name, surname, age')
->where('age', '>', 18)
->orderBy('id', 'desc')
->limit(20)
->getAll();
dd($records);Detailed Usage and Methods
config
Contents
select
select functions (min, max, sum, avg, count)
table
get AND getAll
join
where
grouped
in
findInSet
between
like
groupBy
having
orderBy
limit - offset
pagination
insert
update
delete
analyze - check - checksum - optimize - repair
query
insertId
numRows
cache
transaction - commit - rollBack
error
queryCount
getQuery
Methods
select
select functions (min, max, sum, avg, count)
table
get AND getAll
join
You can use this method in 7 ways. These;
join
left_join
right_join
inner_join
full_outer_join
left_outer_join
right_outer_join
Examples:
where
You can use this method in 4 ways. These;
where
orWhere
notWhere
orNotWhere
whereNull
whereNotNull
Example:
grouped
in
You can use this method in 4 ways. These;
in
orIn
notIn
orNotIn
Example:
findInSet
You can use this method in 4 ways. These;
findInSet
orFindInSet
notFindInSet
orNotFindInSet
Example:
between
You can use this method in 4 ways. These;
between
orBetween
notBetween
orNotBetween
Example:
like
You can use this method in 4 ways. These;
like
orLike
notLike
orNotLike
Example:
groupBy
having
orderBy
limit - offset
pagination
insert
update
delete
transaction
analyze
check
checksum
optimize
repair
query
insertId
numRows
error
cache
queryCount
getQuery
Last updated