Is it possible to make a select of some tables and push them into a Multidimensional array?
(i am using PDO fetch_all)
or do i have to make several selects ?
tables
TABLE xxx
id | xxx | aaa | bbb | ccc
---------------------
1 | 666 | 111 | 222 | 333
2 | 777 | 444 | 555 | 666
TABLE positions
xxx | yyy | zzz
----------------
666 | 999 | 000
666 | 888 | 111
777 | 999 | 000
777 | 888 | 222
777 | 777 | 333
--^ //forenerkey from table xxx
What I want to achieve is
Array
(
[0] => Array
(
[id] => 1
[aaa] => 111
[bbb] => 222
[ccc] => 333
[xxx] => 666
[positions] => Array(
[0] => Array(
[xxx] => 666
[yyy] => 999
[zzz] => 000
)
[1] => Array(
[xxx] => 666
[yyy] => 888
[zzz] => 111
)
)
)
[1] => Array
(
[id] => 2
[aaa] => 222
[bbb] => 333
[ccc] => 444
[xxx] => 777
[positions] => Array(
[0] => Array(
[xxx] => 777
[yyy] => 999
[zzz] => 000
)
[1] => Array(
[xxx] => 777
[yyy] => 888
[zzz] => 222
)
[2] => Array(
[xxx] => 777
[yyy] => 777
[zzz] => 333
)
)
)
)
Atm I select like this
select * from xxx x, position p where x.xxx=p.xxx
But the result is not as I like it. BTW, I don't even know how this should look like in mysql result ^^. Have to do a lot of afterwork to make the array like I want it in the end. Actually I have all done but I really would like to shrink my source :D
positions[1] => Array([xxx] => 777, [yyy] => 999, [zzz] => 000 )[666,888,111]instead of[777,999,000]