Cara Membuat Website dengan Mudah - File: view.php

artikel kali ini membahas mengenai lanjutan dari artikel sebelumnya, dan silahkan copy dan simpan kode program dibawah ini dengan nama view.php

<?php
include('config.php');
include('cek-login.php');
?>

<html>
<head>
<title>Belajar PHP</title>
</head>

<body>
<h1>Data User</h1>

<?php
if (!empty($_GET['message']) && $_GET['message'] == 'success') {
echo '<h3>Berhasil meng-update data!</h3>';
} else if (!empty($_GET['message']) && $_GET['message'] == 'delete') {
echo '<h3>Berhasil menghapus data!</h3>';
}
?>

<a href="index.php">+ Tambah Data</a>

<table border="1" cellpadding="5" cellspacing="0">
<thead>
    <tr>
        <td>No.</td>
        <td>Username</td>
        <td>Password</td>
        <td>Email</td>
        <td>Fullname</td>
        <td>Agama</td>
        <td>No. HP</td>
        <td>Opsi</td>
        </tr>
    </thead>
    <tbody>
    <?php
$query = mysql_query("select * from user");

$no = 1;
while ($data = mysql_fetch_array($query)) {
?>
    <tr>
        <td><?php echo $no; ?></td>
        <td><?php echo $data['username']; ?></td>
        <td><?php echo $data['password']; ?></td>
        <td><?php echo $data['email']; ?></td>
        <td><?php echo $data['fullname']; ?></td>
        <td><?php echo $data['agama']; ?></td>
        <td><?php echo $data['no_hp']; ?></td>
            <td>
            <a href="edit.php?id=<?php echo $data['user_id']; ?>">Edit</a> ||
                <a href="delete.php?id=<?php echo $data['user_id']; ?>">Hapus</a>
            </td>
        </tr>
    <?php
$no++;
}
?>
    </tbody>
</table>
</body>
</html>


jika sudah, kita telah berhasil membuat sebuah website sederhana yang bersifat website dinamis, dan silahkan simpan seluruh file pada xampp/htdocs, dan buat lah sebuah folder terserah kamu didalmnya lalu simpan file-file yang telah dibuat dengan tutorial yang telah diberikan.

Jalankan web browser kamu, dan ketikan link untuk menampilkan hasil kerja kamu, seperti: localhost/rianfartawijaya.com

selamat mencoba dan semoga berhasil.

TUTORIAL LENGKAPNYA DAPAT DIUNDUH DI LINK INI:
Cara Membuat Website Dengan Mudah
Cara Membuat Website dengan Mudah - File: cek-login.php
Cara Membuat Website dengan Mudah - File: config.php
Cara Membuat Website dengan Mudah - File: delete.php
Cara Membuat Website dengan Mudah - File: edit.php
Cara Membuat Website dengan Mudah - File: index.php
Cara Membuat Website dengan Mudah - File: insert.php
Cara Membuat Website dengan Mudah - File: login.php
Cara Membuat Website dengan Mudah - File: logout.php
Cara Membuat Website dengan Mudah - File: otentikasi.php
Cara Membuat Website dengan Mudah - File: view.php
Cara Membuat Website dengan Mudah - File: update.php
Mari Belajar Teknologi Informasi

0 Response to "Cara Membuat Website dengan Mudah - File: view.php"

Post a Comment