jwdcfdeveloper
Programmer
I am looking for a way to optimize the queries for a website I am working on. I am displaying a page with a bunch of products. The page includes:
1. Product id
2. Product name
3. Prices (depends on the customers status but there 5 different prices for each product)
4. text field to hold number of each product ordered
The first three fields come from the database. The way I am getting them is by creating a query to list the needed product ids to display on the page. I then create a loop with the first query and then use a second query inside of the loop to get the prices for each product. In this case, there are 69 products to display on the page times 5 prices per product equals a long load time for the page. How can I use QoQ, or an array, structure or anything that would cause me not to create 69 loops to accomplish this task?
Thanks,
JW
1. Product id
2. Product name
3. Prices (depends on the customers status but there 5 different prices for each product)
4. text field to hold number of each product ordered
The first three fields come from the database. The way I am getting them is by creating a query to list the needed product ids to display on the page. I then create a loop with the first query and then use a second query inside of the loop to get the prices for each product. In this case, there are 69 products to display on the page times 5 prices per product equals a long load time for the page. How can I use QoQ, or an array, structure or anything that would cause me not to create 69 loops to accomplish this task?
Thanks,
JW