Hello Form,
This is my first post here so hello to all .
Ok now for my question.
i am making an CMS system for a school project.
we have decided to work with smarty.
Now this question is about 2 tables.
table 1:
attributes
it contains the collums 'att_Id, att_Lable and att_Name'
table 2:
pg_Data(page data)
this contains the collums 'dat_Id, att_Id, dat_Lable and dat_Name'
This table contains the values for the attributes from table 1.
in short:
|table 1
|------------------------------------------------|
| att_Id | att_Lable | att_Name |
|------------------------------------------------|
| 1 | head | Head |
|table 2
|------------------------------------------------------------|
| dat_Id | att_Id | dat_Value |
|------------------------------------------------------------|
| 1 | 1 | This is a text |
now i need a query that need a query that get out de att_label from table 1 en the value from table 2.
SELECT dat.dat_Value, att.att_Lable
FROM pg_Attributes AS att LEFT JOIN pg_Data AS dat
ON att.att_Id = dat.att_Id
then i get an output in php
array(
[dat_Value] => this is a text
[att_Lable] => head
)
now this is all good but i want to get the lable of the attribute in de key of the value.
So it would look like this.
array(
[head] => this is a text
)
is there anyone how understands this and can help me
let me know.