Jump to content

filter results of query


webguy262

Recommended Posts

I am modifying some pages in CRE Loaded.

 

allprods.php list all currently active products and I added a manufacturers column that displays who makes that product.

 

I want to allow shoppers to filter the product list so that it shows only products from a particular manufacturer.

 

I have gone through several scenarios in my mind, but nothing I've thought of seems simple and bullet proof.

 

One of the issues is that the all products query includes all manufacturers.  If I were to put a variable in the query to select only a particular manufacturer, how would I code it so it does not interfere with the all products query?

 

Would logic based upon the value of a form action work?  If form action exists, someone wants to filter.  If not form action or form action = all, then they want the whole list.

 

Seems like filtering a list is pretty common and there should be an easy solution.

 

Suggestions?

 

TIA

Link to comment
https://forums.phpfreaks.com/topic/70348-filter-results-of-query/
Share on other sites

Would logic based upon the value of a form action work?  If form action exists, someone wants to filter.  If not form action or form action = all, then they want the whole list.

 

Yeah, something like that. You would then have two seperate queries. One sorted selecting only a certain manufacturer, the other as per normal. Can't really help much more without seeing some code.

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.