Here is my basic participants
table (displayed as associative array):
[id] => 1
[campaign_id] => 41
[firstname] => Jeff
[lastname] => Berube
On another table, named participants_custom
, I can add multiple custom data, that belongs to a participants
row. Like this:
[id] => 51
[participant_id] => 1
[name] => textfield_bh423vjhgv
[data] => qwerty1
[id] => 52
[participant_id] => 1
[name] => textfield_IDRr2kzjZR59Xjw
[data] => qwerty2
[id] => 53
[participant_id] => 1
[name] => textfield_6kj5bhjjg
[data] => qwerty3
I am currently making a join
, but it adds the only name
, participant_id
and data
to my row. What I want is my query to return something like this:
[id] => 1
[campaign_id] => 41
[firstname] => Jeff
[lastname] => Berube
[textfield_bh423vjhgv] => qwerty1
[textfield_IDRr2kzjZR59Xjw] => qwerty2
[textfield_6kj5bhjjg] => qwerty3
Where row value name
becomes a column, and value
, it's value. How can I make it?
I found this and this, which was unsuccessful. I'm finding a way that would work with my situation. Thanks for any help.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…