I'm using PDO to run a mysql query with 2 joins and this is the result I get from the database:
Array
(
[0] => Array
(
[id] => 489
[cluster_id] =>
[label_value_id] => 4
[label_id] => 1
[int_value] => 40
)
[1] => Array
(
[id] => 489
[cluster_id] =>
[label_value_id] => 6
[label_id] => 2
[int_value] => 20
)
[2] => Array
(
[id] => 489
[cluster_id] =>
[label_value_id] => 9
[label_id] => 3
[int_value] => 10
)
)
The idea is that there will be multiple id's later on but for simplicities sake I only have 1 entry with id 489 for now.
I need the 3 arrays (cause of the joins) to be 1 array that looks something like this, I want a subarray based on the label-value_id => int_value relationship:
Array
(
[0] => Array
(
[id] => 489
[cluster_id] =>
[label_value_id] => 4
[label_id] => 1
[int_value] => 40
[vector_data] => Array
(
[4] => 40
[6] => 20
[9] => 10
)
)
)
I'd rather have this done in the PHP and not the Query because I dont have control over the queries when I implement this into the live application.
Any help is much appreciated!