Fill a datatable with PHP from Array

Fill a datatable with PHP from Array

rbtrbt Posts: 1Questions: 1Answers: 0
edited November 2017 in Free community support

Hello

This is my Array :

[0] => Array (
    [0] => Array (
        [0] => perimeter.name
        [1] => nom
        [2] => heure
        [3] => durée
        )
    [1] => Array (
        [0] => QX06
        [1] => adm
        [2] => 20:00
        [3] => 960
        )
    [2] => Array (
        [0] => TX7
        [1] => adm01
        [2] => 20:00
        [3] => 960
        )

My question :
How to fill my datatable ?

I have try something like this :

                 <table id="datatable-buttons" class="table table-striped table-bordered">
                 <thead>
                 <tr>
                      <th>ID</th>
                      <th>Nom</th>
                      <th>Description</th>
                      <th>Date de provisionnement</th>
                </tr>
                 </thead>
                 <tbody>
                <?php foreach ($arrayData as $row): array_map('htmlentities', $row); ?>
                 <tr>
                 <td><?php echo implode('</td>', $row); ?></td>
                 </tr>
                 <?php endforeach; ?>
                 </tbody>
                 </table>

but it doesn't work. Please help :)

Regards

Answers

  • allanallan Posts: 63,464Questions: 1Answers: 10,466 Site admin

    If you "View source" on the page, what does the generated HTML look like?

    Allan

This discussion has been closed.