php - Create SQL query with more than one where clause -
i'm trying query 2 where
clauses like:
select * table1 `name` = 'paul' , `id` = 1
in laravel eloquent, don't know correct syntax.
simple, use where
model::where('name', '=', 'paul')->where('id', '=', 1);
then may use get()
or first()
fetch row(s).
if want use query builder(fluent) replace model::
db::table('table1')->
.
note
=
optional here. here can use other operators.
update
from laravel 4.2 can use array:
model::where([ 'name' => 'paul', 'id' => 1 ]);
Comments
Post a Comment