jonw118 Posted October 31, 2008 Share Posted October 31, 2008 I think this should be pretty easy... I have a line in my code that currently reads: "where p.products_id = p2c.products_id and products_status = '1' and p2c.categories_id = 50 " . That 50 is a category number. What I need is for it to pull multiple categories from the database (ie: 48, 49, 50, etc). I tried using commas, and that didn't cut it. How can I join serveral different categories? THANKS SO MUCH FOR ANY HELP!! Quote Link to comment Share on other sites More sharing options...
Jeremysr Posted October 31, 2008 Share Posted October 31, 2008 This will probably work: where p.products_id = p2c.products_id and products_status = '1' and (p2c.categories_id = 48 or p2c.categories_id = 49 or p2c.categories_id = 50) Or this: where p.products_id = p2c.products_id and products_status = '1' and (p2c.categories_id >= 48 and p2c.categories_id <= 50) Quote Link to comment Share on other sites More sharing options...
jonw118 Posted October 31, 2008 Author Share Posted October 31, 2008 Thanks so much for trying to help me... I really appreciate it! Unfortunately it gives this error: Parse error: syntax error, unexpected T_STRING in /home/mercant/public_html/legendsrecognition/includes/modules/new_products.php on line 34 (Line 34, btw, is that line I changed). Any thoughts? Quote Link to comment Share on other sites More sharing options...
jonw118 Posted October 31, 2008 Author Share Posted October 31, 2008 NEVERMIND - I'm an idiot... That worked! Again, thank you for taking the time to help me. 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.