Welcome Guest, Not a member yet? Register   Sign In
multiple query results in a loop to be passed in a view
#6

[eluser]rei[/eluser]
Thanks. here is my database table structure.

products table:
id, name, price

option_keys table:
id, prod_id, option_key

option_values table:
id, option_id, option_value, price



Here's what I did:

1. query all the products and store the product_id's in an array
2 SELECT * FROM option_keys WHERE prod_id IN ($prod_ids);

I'm getting this result:

id prod_id option_key
1 5 size
3 5 color
4 6 weight
6 6 style
7 5 font



Now the question is how can I assign the option_keys to be an array or object and assign them to their corresponding parent(prod_id)


Messages In This Thread
multiple query results in a loop to be passed in a view - by El Forum - 08-21-2012, 06:52 AM
multiple query results in a loop to be passed in a view - by El Forum - 08-21-2012, 07:21 AM
multiple query results in a loop to be passed in a view - by El Forum - 08-21-2012, 03:53 PM
multiple query results in a loop to be passed in a view - by El Forum - 08-23-2012, 05:18 PM
multiple query results in a loop to be passed in a view - by El Forum - 08-23-2012, 05:30 PM
multiple query results in a loop to be passed in a view - by El Forum - 08-23-2012, 05:54 PM
multiple query results in a loop to be passed in a view - by El Forum - 08-23-2012, 06:02 PM
multiple query results in a loop to be passed in a view - by El Forum - 08-23-2012, 06:55 PM
multiple query results in a loop to be passed in a view - by El Forum - 08-23-2012, 07:39 PM
multiple query results in a loop to be passed in a view - by El Forum - 08-24-2012, 07:27 AM



Theme © iAndrew 2016 - Forum software by © MyBB