xiao Posted April 18, 2008 Share Posted April 18, 2008 What I need: All products with a model starting with 'DVD-FD' OR 'DVD-DH'. My code doesn't return stuff that starts with 'DVD-FD' (it does return the one with 'DVD-DH'). And it also return a product with 'MG....' $qryProcessor = mysql_query("SELECT p.products_id, p.products_model, p.products_price, pd.products_name FROM products p, products_description pd WHERE p.products_id = pd.products_id AND pd.language_id = 1 AND p.products_model LIKE 'DVD-DH%' OR p.products_model LIKE 'DVD-FD%' GROUP BY p.products_id ORDER BY p.products_price") or die(mysql_error()); I'm using osCommerce if it helps. Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted April 18, 2008 Share Posted April 18, 2008 Put parenthesis around the OR part: <?php $qryProcessor = mysql_query("SELECT p.products_id, p.products_model, p.products_price, pd.products_name FROM products p, products_description pd WHERE p.products_id = pd.products_id AND pd.language_id = 1 AND (p.products_model LIKE 'DVD-DH%' OR p.products_model LIKE 'DVD-FD%') GROUP BY p.products_id ORDER BY p.products_price") or die(mysql_error()); ?> Quote Link to comment Share on other sites More sharing options...
xiao Posted April 18, 2008 Author Share Posted April 18, 2008 niiiice, thanks a lot Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.