Reputation: 318
So a quick question here, I have two tables within my database which is connected to a Yii2 web application.
My two tables are named attributes and people, I have a CRUD area for both of them so I can manipulate the the contents of each table separately.
The two tables are extremely simple at the moment and are structured as follows.
Attribute Table:
attribute_id | attribute_name
------------------------------
People Table:
person_id | person_name
------------------------------
Now the attribute names will be items like hair color, eye color, weight, etc
Now what I want is to be able to assign an attribute to a particular person with a value, for example if person1 existed, I want to assign hair color (Assuming hair color already exists as an attribute) with a value such as 'brown' to person1.
At the moment I kind of have a mental block and don't really know how to go forward from this point on, could anyone point me in the right direction or help me out here?
Cheers.
Upvotes: 1
Views: 53
Reputation: 204894
You need another table
person_attributes
-----------------
person_id
attribute_id
value
Upvotes: 2