Page 1 of 1

query with two conditions

Posted: Wed Jan 04, 2012 6:18 pm
by inosent1

Code: Select all

$query="select * from ldata where $term_s LIKE '%$term%'";

i want to search based on 2 conditions

eg

Code: Select all

$query="select * from ldata where $term_s LIKE '%$term%' AND WHERE entity='$company'";
but i dont know the precise syntax

Re: query with two conditions

Posted: Wed Jan 04, 2012 6:41 pm
by twinedev
You were very close, just get rid of the second "WHERE":

Code: Select all

$query="SELECT * FROM `ldata` WHERE `$term_s` LIKE '%$term%' AND `entity`='$company'";