Hi all, i'm stuck.
I have a database which allows multiple data elements to be stored for a given value, each of which has a key.
An example of what i want to do featuring the following tables:
car = list of cars
car_attributes = list of possible attributes (e.g. number of wheels, engine size, etc)
car_data = the actual data for an attribute (e.g. 4 wheels)
A given car can have any number of attributes (>1), e.g. one car might just have the number of wheels set, while another the number of wheels and the engine size.
I want to be able to do a select like this:
select car_attribute.name, car_data.data from car_attributes, car_data where car_attributes.car_id = 1 and car_attributes.id = car_data.id;
This i want to dump into an array that I can use the attribute name as the key, e.g.
$car["wheels"], or
$car["engine"]
Does anyone have an idea how i can do this, coz i have tried a number of syntaxes and none of them give me what i need.
Thanks a lot,
Jim