Forum


Replies: 7   Views: 95
Create a while loop in php to create a table

Posted by admin  · 16-05-2019 - 10:18

Hello,

To accomplish that task using a template you can:

$docx = new CreateDocxFromTemplate('template.docx');

$data = array(
    array(
        'ITEM' => 'Product A',
        'REFERENCE' => '107AW3',
    ),
    array(
        'ITEM' => 'Product B',
        'REFERENCE' => '204RS67O',
    ),
    array(
        'ITEM' => 'Product C',
        'REFERENCE' => '25GTR56',
    ),
);
$docx->replaceTableVariable($data);

How to extract the information and generate an array from it depends on the function or method you are using to access the database: mysql functions, PDO, ORM...

We recommend you to check the included samples and the information available on the API pages of each method, that illustrate how to accomplish these kind of tasks.

Regards.