how to output to the template, records in the loop, at the moment only one line is output to the template, although the cycle displays 4 lines

$sql="SELECT mu.fullname, mp.name as namep, mp.price as pricep FROM modx_shopkeeper3_orders mo left JOIN modx_shopkeeper3_purchases mp on mp.order_id=mo.id left join modx_user_attributes mu on mu.id=mo.userid where mo.id=36"; $result = mysql_query($sql); $document = $PHPWord->loadTemplate('chek.docx'); //шаблон $document->setValue('user', 'Иванов'); // while ($parent = mysql_fetch_assoc($result)) { $document->setValue('blyudo', $parent['namep'].'.....'.$parent['pricep']); //фамилияотчество } $document->setValue('city', 'Минск'); //фамилияотчество $document->save('Template_full.docx'); //имя заполненного шаблона для сохранения } } 

template

 Обед ${fio} ${name} ${price} Приятного аппетита!!! ${adress} 
  • The question is not clear. What is your while ($parent = mysql_fetch_assoc($result)) not a loop? Give an example of input and output (which you want). - E_p
  • the cycle then I have sushi 200r and dessert 300r salad 450r, but only 450r salad is written into the document template, and the previous ones are not recorded - Aslero
  • Well, so logical. You write different values ​​in one variable. And then "write down" the last value ... Here you can either do a template with a cycle or make a variable in the loop that has everything. - E_p
  • figured out while ($ parent = mysql_fetch_assoc ($ result)) {$ blyudo. = $ parent ['namep']. ".....". $ parent ['pricep']. "\ n"; } $ document-> setValue ('blyudo', $ blyudo); - Aslero
  • But how to print this file later, I did not find it in the documentation - Aslero

0