Last active
November 8, 2017 11:46
-
-
Save galihazizif/ef19961ac08f5a93c13a1209c376347c to your computer and use it in GitHub Desktop.
bukutamu/page/home.php
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 | |
try{ | |
$dbConfig = $config['db']; | |
$pdo = new PDO($dbConfig['dsn'],$dbConfig['username'],$dbConfig['password']); | |
$sql = " SELECT * FROM daftar_tamu"; | |
$pds = $pdo->query($sql); | |
$data = $pds->fetchAll(); | |
}catch(PDOException $e){ | |
echo $e->getMessage(); | |
exit(); | |
} | |
?> | |
<h3>Selamat datang di halaman buku tamu</h3> | |
<p>Berikut ini data tamu yang telah mengisi buku tamu</p> | |
<?php if(count($data) > 0): ?> | |
<table> | |
<tr> | |
<td>ID</td> | |
<td>Nama</td> | |
<td>Alamat</td> | |
<td>Email</td> | |
</tr> | |
<?php foreach($data as $tamu): ?> | |
<tr> | |
<td><?=$tamu['id'] ?></td> | |
<td><?=$tamu['nama'] ?></td> | |
<td><?=$tamu['alamat'] ?></td> | |
<td><?=$tamu['email'] ?></td> | |
</tr> | |
<?php endforeach; ?> | |
</table> | |
<?php else: ?> | |
Belum ada tamu | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment