Welcome Guest, Not a member yet? Register   Sign In
confusion with where query and arrays
#7

[eluser]mddd[/eluser]
You almost got it. The idea is to have one line for each 'link'.
So you would have the 'colours' table like you show. And you would have the 'items' table containing all the other info about each item (its style, description, whatever). And you have the link table:
Code:
table 'items_colours'

id        item_id   color_id
1         123       1
2         123       2
3         456       1
In this example, item 123 is blue and green, item 456 is only blue.

If you wanted to find all the items that are blue, you would search for all item_ids from the link table where color_id=1.
And you'd probably do that in a join query which joins the items_colors to the items table so you'd get all the item information at the same time as finding those item_ids.


Messages In This Thread
confusion with where query and arrays - by El Forum - 08-25-2010, 07:32 AM
confusion with where query and arrays - by El Forum - 08-25-2010, 08:02 AM
confusion with where query and arrays - by El Forum - 08-25-2010, 09:46 AM
confusion with where query and arrays - by El Forum - 08-25-2010, 09:53 AM
confusion with where query and arrays - by El Forum - 08-25-2010, 10:00 AM
confusion with where query and arrays - by El Forum - 08-25-2010, 10:27 AM
confusion with where query and arrays - by El Forum - 08-25-2010, 10:33 AM
confusion with where query and arrays - by El Forum - 08-25-2010, 10:43 AM



Theme © iAndrew 2016 - Forum software by © MyBB