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!! Link to comment https://forums.phpfreaks.com/topic/130827-solved-pulling-multiple-categories/ 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) Link to comment https://forums.phpfreaks.com/topic/130827-solved-pulling-multiple-categories/#findComment-679018 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? Link to comment https://forums.phpfreaks.com/topic/130827-solved-pulling-multiple-categories/#findComment-679021 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. Link to comment https://forums.phpfreaks.com/topic/130827-solved-pulling-multiple-categories/#findComment-679025 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.