Answer the question
In order to leave comments, you need to log in
How to create an array from while values?
Now the page has this code:
$aBitrixParamsID = Array(
"Зеленый" => "2014",
"Синий" => "2015",
"Красный" => "2048",
"Белый" => "2016",
// и еще 100 всяких цветов с id-шниками
);
while($ar_fields = $my_slider->GetNext())
{
echo $ar_fields['PROPERTY_COLOR_VALUE']; //выведет Зеленый, Синий, Зеленый, Белый, Белый....
echo $ar_fields['PROPERTY_COLOR_ENUM_ID']; //выведет 2014, 2015, 2014, 2016, 2016.....
}
Answer the question
In order to leave comments, you need to log in
Not?
$colors = [];
while($ar_fields = $my_slider->GetNext()) {
$colors[$ar_fields['PROPERTY_COLOR_ENUM_ID']] = $ar_fields['PROPERTY_COLOR_VALUE'];
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question