Skip to content

Instantly share code, notes, and snippets.

@sebgates
Created May 21, 2018 16:56
Show Gist options
  • Save sebgates/84c37beeecd5318f88cdb734feb4ee3a to your computer and use it in GitHub Desktop.
Save sebgates/84c37beeecd5318f88cdb734feb4ee3a to your computer and use it in GitHub Desktop.
<!-- Here is a basic HTML table -->
<table>
<tr>
<th>ID</th>
<th>Name</th>
<th>Power Rating</th>
<th>Created on</th>
</tr>
<!-- A foreach loop creates an array that we can then use to loop through -->
<?php foreach ($records as $record) : ?>
<tr>
<!-- Replace id, name and price with your own column headings from your table -->
<td><?php echo $record['id']; ?></td>
<td><?php echo $record['name']; ?></td>
<td><?php echo $record['price']; ?>%</td>
<!-- Here is the PHP date function in action, you can change d F Y to suit your project -->
<td><?php echo date('d F Y', strtotime($record['date-created'])); ?></td>
</tr>
<?php endforeach; ?>
</table>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment