RE: Complex query with PHP/MySQL

2002-03-01 Thread Doug Thompson
You're producing a query of the form SELECT x,y,z FROM table WHERE cat ="a,b,c" AND subcat="d,e,f"; Try: IMPLODE("\" OR \"",$category) or maybe even IMPLODE('" OR "',$category) to remove all the escaping. Doug On Fri, 1 Mar 2002 16:14:17 -, John Lodge wrote: >This is the sort of thing

RE: Complex query with PHP/MySQL

2002-03-01 Thread John Lodge
This is the sort of thing I would do $tmpquery = "SELECT item_pic, cat, sub, item_name, username FROM item_name WHERE 1=1 AND"; if($category) { $filter1 = " cat =\""; $filter1 .= implode("\",\"",$category); $filter1 .= " \" "; $tmpquery .= $filter1; $tmpquery .= " AND "; } if($subcat) { $filter2