Good day, gentlemen. there is the following foreach ($result_list as $entry2) { $row[$entry2["id"]][] = $entry2["value_obj"]; } foreach ($result_list as $entry2) { $row[$entry2["id"]][] = $entry2["value_obj"]; }
he leads so
Array ( [324] => Array ( [0] => 7 [1] => 16 [2] => 21 [3] => 26 [4] => 44 [5] => 33 [6] => 88 [7] => 1 [8] => 1 ) [307] => Array ( [0] => 5 [1] => 48 [2] => 67 [3] => 88 [4] => 5 [5] => 2 [6] => 52 [7] => 55 [8] => 56 [9] => 58 ) Where 324 and 307 product ID and all that in the array of its characteristics. The question of how to make it so that instead of indices the names of the characteristics are displayed which I take from the database "param_name"
$result=mysql_query($sql ); $result_list = array(); while($row = mysql_fetch_array($result)) { $result_list[] = $row; } Here's the query, but the fact is that when I do $row[$entry2["id"]][]=$entry2["param_name"]. $entry2["value_obj"]; $row[$entry2["id"]][]=$entry2["param_name"]. $entry2["value_obj"]; he only lists me all separated by a comma.
$sql="SELECT ore_apartment_city.name_ru,address_ru,description_ru,lat,lng,ore_apartment.id,phone,ore_apartment_obj_type.name_ru,ore_apartment_kind.representation,price,ore_apartment_properties.property_id,ore_apartment_properties.value_obj,ore_additional_properties.name,ore_additional_properties.param_name FROM ore_apartment,ore_apartment_city,ore_apartment_obj_type,ore_apartment_kind,ore_apartment_properties,ore_additional_properties WHERE ore_apartment_city.id=ore_apartment.city_id AND ore_apartment_obj_type.id=ore_apartment.obj_type_id AND ore_apartment_kind.id=ore_apartment.kind_id AND ore_apartment.id = ore_apartment_properties.apartment_id AND ore_additional_properties.id = ore_apartment_properties.property_id";