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