Advertisement
cdsatrian

pencarian.php

Apr 29th, 2014
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.98 KB | None | 0 0
  1. <?php
  2. include "./include/koneksi_db.php";
  3. $sql=mysql_query("SELECT * FROM data_anggota WHERE {$_POST['per']} "
  4.                .($_POST['per']=='id'?"='{$_POST['text']}' ":"LIKE '%{$_POST['text']}%' "));
  5. if(mysql_num_rows($sql)>0){
  6.   while($res=mysql_fetch_array($sql)){
  7. ?>
  8. <table width="90%" border="4" cellspacing="4" cellpadding="4">
  9.   <tr>
  10.     <td colspan="2"><strong>Hasil Pencarian</strong><hr></td>
  11.   </tr>
  12.   <tr>
  13.     <td width="50%"><strong>ID Anggota</strong></td>
  14.     <td width="50%"><strong>: </strong><?=$res['id'];?></td>
  15.   </tr>
  16.   <tr>
  17.     <td><strong>Nomor induk</strong></td>
  18.     <td><strong>: </strong><?=$res['no_induk'];?></td>
  19.   </tr>
  20.   <tr>
  21.     <td><strong>nama</strong></td>
  22.     <td><strong>: </strong><?=$res['nama'];?></td>
  23.   </tr>
  24.   <tr>
  25.     <td><strong>jenis kelamin</strong></td>
  26.     <td><strong>:</strong> <?=$res['jk'];?></td>
  27.   </tr>
  28.   <tr>
  29.     <td><strong>kelas</strong></td>
  30.     <td><strong>:</strong> <?=$res['kelas'];?></td>
  31.   </tr>
  32.    <tr>
  33.     <td><strong>tempat tanggal lahir</strong></td>
  34.     <td><strong>:</strong> <?=$res['ttl'];?></td>
  35.   </tr>
  36.    <tr>
  37.     <td><strong>alamat</strong></td>
  38.     <td><strong>:</strong> <?=$res['alamat'];?></td>
  39.   </tr>
  40. </table>
  41. <?php
  42.   }
  43. }
  44. if($_POST['per']=='id'){
  45.     $sql=mysql_query("SELECT * FROM data_buku WHERE id='".$_POST['text']."'");
  46.     if(mysql_num_rows($sql)>0){
  47.       $res=mysql_fetch_array($sql);
  48.     ?>
  49. <table width="50%" border="0" cellspacing="1" cellpadding="4">
  50.   <tr>
  51.     <td colspan="2"><strong>Hasil Pencarian</strong><hr></td>
  52.   </tr>
  53.   <tr>
  54.     <td><strong>ID Buku</strong></td>
  55.     <td><strong>:</strong> <?=$res['id'];?></td>
  56.   </tr>
  57.   <tr>
  58.     <td><strong>Judul</strong></td>
  59.     <td><strong>: </strong><?=$res['judul'];?></td>
  60.   </tr>
  61.   <tr>
  62.     <td><strong>Pengarang</strong></td>
  63.     <td><strong>:</strong> <?=$res['pengarang'];?></td>
  64.   </tr>
  65.   <tr>
  66.     <td><strong>tahun Penerbit</strong></td>
  67.     <td><strong>:</strong> <?=$res['th_terbit'];?></td>
  68.   </tr>
  69.   <tr>
  70.     <td><strong>penerbit</strong></td>
  71.     <td><strong>:</strong> <?=$res['penerbit'];?></td>
  72.   </tr>
  73.   <tr>
  74.     <td><strong>isbn</strong></td>
  75.     <td><strong>:</strong> <?=$res['isbn'];?></td>
  76.   </tr>
  77.   <tr>
  78.     <td><strong>kategori</strong></td>
  79.     <td><strong>:</strong> <?=$res['kategori'];?></td>
  80.   </tr>
  81.   <tr>
  82.     <td><strong>kode kelas</strong></td>
  83.     <td><strong>:</strong> <?=$res['kode_klas'];?></td>
  84.   </tr>
  85.   <tr>
  86.     <td><strong>jumlah buku</strong></td>
  87.     <td><strong>:</strong> <?=$res['jumlah_buku'];?></td>
  88.   </tr>
  89.   <tr>
  90.     <td><strong>lokasi</strong></td>
  91.     <td><strong>:</strong> <?=$res['lokasi'];?></td>
  92.   </tr>
  93.   <tr>
  94.     <td><strong>asal</strong></td>
  95.     <td><strong>:</strong> <?=$res['asal'];?></td>
  96.   </tr>
  97.   <tr>
  98.     <td><strong>jum_temp</strong></td>
  99.     <td><strong>:</strong> <?=$res['jum_temp'];?></td>
  100.   </tr>
  101.   <tr>
  102.     <td><strong>tanggal input</strong></td>
  103.     <td><strong>:</strong> <?=$res['tgl_input'];?></td>
  104.   </tr>
  105. </table>
  106. <? }
  107. }
  108. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement