Created
June 5, 2020 18:28
-
-
Save AdamZWinter/3312630d4d400092a3b3e26c650f8091 to your computer and use it in GitHub Desktop.
Common steps for displaying database table.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require('/var/www/html/.../header.php'); | |
$active = 'yes'; | |
$query = "SELECT * FROM calendars WHERE active = ?"; | |
$stmt = $db->prepare($query); | |
$stmt->bind_param('s', $active); | |
$stmt->execute(); | |
$result = $stmt->get_result(); | |
echo '<table>'; | |
while ($row = $result->fetch_row()) { | |
echo '<tr>'; | |
foreach($row as $columnValue){ | |
echo '<td><p>'.$columnValue.'</p></td>'; | |
} | |
echo '</tr>'; | |
} | |
echo '</table>'; | |
$result->close(); | |
$stmt->close(); | |
require('/var/www/html/.../footer.php'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment