PHP Classes

MultiD Arrays

Recommend this page to a friend!

      Top level forums  >  PHP Specialists  >  General  >  MultiD Arrays  
Subject:MultiD Arrays
Summary:mudinensional array problem
Messages:2
Author:panos
Date:2009-12-15 22:11:43
Update:2009-12-19 23:44:37
 

  1. MultiD Arrays   Reply   Report abuse  
Picture of panos panos - 2009-12-15 22:17:13
hey there

i have a db table that has groups of characteristics and characteristics ids and in another the values of these characteristics

so i want to have in the end an $array[groupOfchar][char][value0fchar];
like car [equip]
[comfort]
[motor]->[co2]
[cc]=>1400
i try to print it like that:
//im not really comf in using arrays
//going for the two dimensions

$queryL1 = "SELECT * FROM tree WHERE level='1' ";
$editions=array();
$query=mysql_query($queryL1);
while($array=mysql_fetch_array($query)){
$editions[]=$array["name"];

foreach ($editions as $key=>$k ){
$queryL2 = "SELECT * FROM tree WHERE assign='$k' ";//so far so good
$L2=array();
$quer=mysql_query($queryL2);
$array2=mysql_fetch_array($quer);
$L2[]=$array2["name"];

foreach ($L2 as $key2=>$v ){
$L2[]=$array2["name"];


}print " Level 1 " . $k ." Level2 -".$v. "<BR>";
}
}

print_r($L2);

i get WRONG data !
thnx

There is 1 reply in this thread, which is not being displayed.
Browsing this forum thread replies is available only to premium subscribers.


Go to the premium subscriptions page to learn how to become a premium subscriber and have full access to this forum.