hi i have the query below…when i test it in phpmyadmin with the variables it works, but it’s not working in my script. I output the variable $cid and it is passing ‘All’. i’m trying to display all records that match the criterias below. when i remove $cid==‘All’ then all the records come up, but when i add in $cid==‘All’ then no results are returned.
($done=='1' && $statid=='All' && $tid=='All' && $assignto=='All' && $cid=='All')
{
$query = "SELECT m.id, DATE_FORMAT(m.mdate,'%m/%d/%Y') as mdate, TIME_FORMAT(m.mdate,'%r') as time, m.lid, m.item, m.description, m.status, DATE_FORMAT(m.date_complete,'%m/%d/%Y'), a.assign, c.cost, w.assignto, w.start, w.finish, p.category, TIME_TO_SEC(w.finish) - TIME_TO_SEC(w.start) AS elapsetime, DATE_FORMAT(w.wdate,'%m/%d/%Y') as wdate, s.sid, s.serviceby, l.descr
FROM maint m
left join assign a on m.aid=a.aid
left join cost c on m.id=c.mid
left join category p on m.cid=p.cid
left join workassign w on w.mid=m.id
left join service s on s.sid=w.assignto
left join location l on l.location=m.lid
WHERE m.date_complete >= '$StartDate' AND m.date_complete <= '$EndDate'
AND m.lid IN ('$lid')
AND (m.item LIKE '%$search%' OR m.description LIKE '%$search%')
ORDER BY m.lid ";
$result = mysql_query($query) or die ("Could not run the query3: " . mysql_error());
}