CodeIgniter Forums
List to Array[][] - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: List to Array[][] (/thread-33956.html)



List to Array[][] - El Forum - 09-14-2010

[eluser]xiii29[/eluser]
Hi !
I'm using CodeIgniter with Doctrine as ORM. In parts of my apps, I need to request 3 tables (A, B & C) where C contains keys of A & B. Looks as C as an N-N associated tables containing infos on the association.

The presentation should be something like that :
B1 | B2 | B3
---------------
A1| C1 | C2 | C3
...

In order to avoid to many request, I would like to retreive all data in one request :
A1 B1 C1
A1 B2 C2
A1 B3 C3
A2 B1 C11
...

And then translate the result in a array :
$arr[<A>][<B>] = <C>

I'm wondering if there some helper or others methods to improve the mechanism ...