Jump to content

[SOLVED] Pulling multiple categories


jonw118

Recommended Posts

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

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)

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.