Prosedur Mysql dan PHP



























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());
?>


Tampil.php

<html>
<head><title>Laporan Data Siswa</title></head>
<body>
<center>Laporan Data Siswa</center><br><br>
<p align="right"><a href="..\belajarphp\fpdf181\cetak_lap_siswa.php">Cetak Laporan</a></p>
<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="call tampil";
      $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?nis=<?php echo $dataTampil['nis'] ; ?>">Delete</a> 
<a href="edit_siswa.php?nis=<?php echo $dataTampil['nis']; ?>">Edit </a></div>
<a href="..\belajarphp\fpdf181\cetak_lap_siswa.php?nis=<?php echo $dataTampil['nis']; ?>">Lap </a></div></td> 
  </tr>
    <?php } ?>
</table>
<center><form name="tambahData" action="input_siswa.php">
<input name="tambah" type="submit" value="Tambah Data Siswa">
</center>
</body>

Tidak ada komentar:

Posting Komentar