Answer the question
In order to leave comments, you need to log in
How to correctly insert values from a php loop into an array?
There is the following code:
CModule::IncludeModule("iblock");
$db_list = CIBlockSection::GetList(array(), array("IBLOCK_ID"=>$arParams["IBLOCK_ID"]), true);
while($ar_result = $db_list->GetNext())
{
echo $ar_result['NAME']."<br>";
$db_list_2 = CIBlockSection::GetList(array(), array('SECTION_ID'=>$ar_result['ID']), true);
while($ar_result_2 = $db_list_2 ->GetNext())
{
echo $ar_result_2['NAME']."<br>";
$res = CIBlockElement::GetList(array(), array('SECTION_ID' => $ar_result_2['ID']), false, false, array());
while($ob = $res->GetNextElement())
{
$arFields = $ob->GetFields();
print_r('Наименование: '.$arFields['NAME'].' ID:'.$arFields['ID'].'<br>');
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question