1. koneksi.php
<?php
$host='localhost';
$user='root';
$pass='';
$db='akademik';
mysql_connect($host,$user,$pass) or die ("Tidak dapat terkoneksi " . mysql_error());
mysql_select_db($db) or die ("Database tidak ditemukan " . mysql_error());
?>
2. tampil_siswa.php
<html>
<head><title>Laporan Data Siswa</title></head>
<body>
<center>Laporan Data Siswa</center><br><br>
<table width="900" border="0" align="center" cellpadding="2" cellspacing="1"
bgcolor="#000000" celpading="2" celspacing="1" >
<tr bgcolor="#CCFFFF">
<td><div align="center"><strong>No</strong></div></td>
<td><div align="center"><strong>Nis</strong></div></td>
<td><div align="center"><strong>Nama Siswa</strong></div></td>
<td colspan=2><div align="center"><strong>Aksi</strong></div></td>
</tr>
<?php
// koneksi database
include ("koneksi.php");
// membaca tabel dan menampilkannya
$no = 0;
$tampil="select * from siswa";
$qryTampil=mysql_query($tampil);
while ($dataTampil=mysql_fetch_array($qryTampil)) {
$no++;
?>
<tr bgcolor="#FFFFFF">
<td><?php echo $no ; ?></td>
<td><?php echo $dataTampil['nis']; ?></td>
<td><?php echo $dataTampil['nama']; ?></td>
<td><div align="center"><a href="hapus_siswa.php?id=<?php echo $dataTampil['nis'] ; ?>">Delete</a>
<a href="edit_siswa.php?nis=<?php echo $dataTampil['nis']; ?>">Edit </a></div></td>
</tr>
<?php } ?>
</table>
<?php
$host='localhost';
$user='root';
$pass='';
$db='akademik';
mysql_connect($host,$user,$pass) or die ("Tidak dapat terkoneksi " . mysql_error());
mysql_select_db($db) or die ("Database tidak ditemukan " . mysql_error());
?>
2. tampil_siswa.php
<html>
<head><title>Laporan Data Siswa</title></head>
<body>
<center>Laporan Data Siswa</center><br><br>
<table width="900" border="0" align="center" cellpadding="2" cellspacing="1"
bgcolor="#000000" celpading="2" celspacing="1" >
<tr bgcolor="#CCFFFF">
<td><div align="center"><strong>No</strong></div></td>
<td><div align="center"><strong>Nis</strong></div></td>
<td><div align="center"><strong>Nama Siswa</strong></div></td>
<td colspan=2><div align="center"><strong>Aksi</strong></div></td>
</tr>
<?php
// koneksi database
include ("koneksi.php");
// membaca tabel dan menampilkannya
$no = 0;
$tampil="select * from siswa";
$qryTampil=mysql_query($tampil);
while ($dataTampil=mysql_fetch_array($qryTampil)) {
$no++;
?>
<tr bgcolor="#FFFFFF">
<td><?php echo $no ; ?></td>
<td><?php echo $dataTampil['nis']; ?></td>
<td><?php echo $dataTampil['nama']; ?></td>
<td><div align="center"><a href="hapus_siswa.php?id=<?php echo $dataTampil['nis'] ; ?>">Delete</a>
<a href="edit_siswa.php?nis=<?php echo $dataTampil['nis']; ?>">Edit </a></div></td>
</tr>
<?php } ?>
</table>
Komentar
Posting Komentar