php - Matrix select from database -


i'm trying receive informations table , information used divided in groups.
know if there way of receiving data in sort of 3d matrix.
i'm doing code in php , on oracle sql developer, can in php, appreciate if information came more "organized".
example:
let's data come out database.

$m = array   (   array("field1"=>1, "field2"=>'1', "field3"=> somedata),     array("field1"=>1, "field2"=>'2', "field3"=> somedata),    array("field1"=>2, "field2"=>'3', "field3"=> somedata),     array("field1"=>2, "field2"=>'4', "field3"=> somedata),     array("field1"=>2, "field2"=>'5', "field3"=> somedata)   ); 

i came out this:

$m = array (   array("1" =>  $m = array     (     array("field2"=>'1', "field3"=> somedata),       array("field2"=>'2', "field3"=> somedata)   )),   array("2" =>  $m = array     (     array("field2"=>'3', "field3"=> somedata),       array("field2"=>'4', "field3"=> somedata),     array("field2"=>'5', "field3"=> somedata)   )) ); 

i don't know if i've have made myself clear, receive data in kind of blocks using column or information parameter, way treat information more on php, because have loops split data in sub-arrays. anyways, , sorry english
p.s.: clarify little more:
acess data(direct db, without treatment) way:

$ar[0]['field1'];//value 2 $ar[0]['field2'];//some value $ar[1]['field1'];//value 2 $ar[1]['field2'];//some value $ar[3]['field1'];//value 3 $ar[3]['field2'];//some value 

and want, kind of, receive this, grouped, in "index" directly return select. , access this:

$ar[0]['field1'][0];  //would return same this($ar[0]) example above $ar[0]['field1'][1];  //would return same this($ar[2]) example above $ar[1]['field1'][0];  //would return same this($ar[3]) example above 

if using oracle, can use rollup , cube provides subtotals. can sort , process details in order. regards, jose


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -