Jump to content

Query Condition


supaflyfrank

Recommended Posts

Is there a way to run a specific query depending on a value received during the query. For example.

I have two types of products. Regular and Packs. Regular is just a single item and packs are a group of different items. Now on my product listing page I want to display all my different types or products. My regular products will basically show image, mini description and price. On my packs I want to display image,mini description, price and a list of products that is included in the pack. But I want the list of products separate from the mini descriptions because its contents can be changed. So I am guessing in my table I need a way to determine if a product is regular or a pack. Therefore I basically have a True/False statement to determine if which type or product it is. The problem is I dont want to run an additional query trying to find all the items in a pack if the current product I am displaying isnt a pack. But at the same time when the query runs their is a chance that the product can be a pack. But this wont be determined until runtime. So I am wondering if their is any runtime query conditional statement that can run a single specific query depending on the product type as in

 

If producttype == "Regular"

  Get Price, MiniDescription and Images

elseif producttype == "Pack"

Get Price,MiniDescription and Images

 

Now I understand that it would be EXTREMELY easy if I just ran one query and then while displaying the item run another query but I wanted to avoid that if possible. So any suggestions would be great.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.