here is my code. it only retrieve last inputted data.

How can i populate all data in a htnl table.

<html>


<?php
$id =new Register();
        $test=Register::selecthey();
            foreach($test as $t=>$sid){
}
        ?>
<table>
    <thead>
        <tr>
            <th>Document ID</th>
            <th>Personnel ID</th>
            <th>Docs Name</th>
            <th>Docs Num</th>
            <th>Docs Date</th>
            <th>FileName</th>
            <th>Data</th>
        </tr>    
    </thead>
    <tbody>

            <tr>
                <td><?= $sid->gov_docs_id ?></td>
                <td><?= $sid->personnel_id ?></td>
                <td><?= $sid->docs_name ?></td>
                <td><?= $sid->docs_num ?></td>
                <td><?= $sid->docs_date ?></td>
                <td><?= $sid->filename?></td>
                <td><button type="button" onclick="javascript:location.href='/getfile/<?= $sid->gov_docs_id?>'">download</button></td>


                </td>
            </tr>
<?}?>           
    </tbody>
    <tfoot>
        <tr>
            <td></td>
        </tr>
    </tfoot>
</table>

</body>
</html>

Recommended Answers

All 4 Replies

Hi, remove the curly bracket } at line 8.

syntax error, unexpected end of file

this is the error i encountered when i removed the curly bracket at line 8

Line 36:

<?}?>

change it to:

<?php } ?>

Or to:

<? } ?>

In practice provide some space.

thanks for help cereal i'm now able to retrieve all data's

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.