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

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -