Hi I have tables producs abd prod_subcat but i can't join the with this code: I echoed the query and it is: SELECT * FROM products pp,prod_subcat ps WHERE (`pp.productID` LIKE '%40%' OR `productName` LIKE '%40%' OR `productDescription` LIKE '%40%' OR `productColour` LIKE '%40%' OR `productID` LIKE '%%' OR `productName` LIKE '%%' OR `productColour` LIKE '%%' ) AND ((ps.subcategoryID='8' AND ps.productID=pp.productID ) OR (ps.subcategoryID='7' AND ps.productID=pp.productID ))ORDER BY productID LIMIT 0,50 PHP: current error: Unknown column 'products.productID' in 'where clause'
Are you sure you have productID field in products table? If yes, try to simplify the query, start with this for example: SELECT * FROM products pp, prod_subcat ps WHERE ps.productID=pp.productID LIMIT 0,50 P.S too many OR make your query slower, as each OR means you run one more query P.P.S "LIKE '%%'" looks strange, try to remove OR-conditions without exact values