Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require 'db/koneksi.php';
- $record = array();
- if ($result = $db->query("SELECT * FROM data")) {
- if ($result->num_rows) {
- while ($row = $result->fetch_object()) {
- $record = $row;
- }
- $result->free();
- }
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>Tampil Data</title>
- </head>
- <body>
- <?php
- if (!count($record)) {
- echo 'tidak ada data';
- }
- ?>
- <table align="center" cellspacing="0" border="1">
- <thead>
- <th>Nama</th>
- <th>Jenis Kelamin</th>
- <th>Alamat</th>
- <th>Kota</th>
- </thead>
- <tbody>
- <?php
- foreach ($record as $r) {
- ?>
- <tr>
- <td><?php echo $r->nama; ?></td>
- <td><?php echo $r->jenis_kelamin; ?></td>
- <td><?php echo $r->alamat; ?></td>
- <td><?php echo $r->kota; ?></td>
- </tr>
- <?php } ?>
- </tbody>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement