bubble_chart StackLab

Activity Logs using HTML + PHP + MySQL

7 steps · pending Not started · person_outline Guest
arrow_back Back

Loop Through the Activity Records

Use a PHP foreach loop:

code php
<?php foreach ($activities as $activity): ?>
This processes every activity record. For example:
code php
<?php foreach ($activities as $activity): ?>

    <tr>

        <td>
            <?= htmlspecialchars(
                $activity['activity_log_id']
            ) ?>
        </td>

    </tr>

<?php endforeach; ?>
Each database record becomes one table row. Conceptually:
code text
Database Records
      ↓
fetchAll()
      ↓
$activities
      ↓
foreach
      ↓
HTML table rows

login Sign in to save your progress permanently. info Progress is saved in your browser session
format_list_numbered Step 5 of 7