daily pastebin goal
47%
SHARE
TWEET

tampil

a guest Oct 23rd, 2017 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. //membuat koneksi ke database
  3. $db_host = "localhost";
  4. $db_user = "root";
  5. $db_pass = "";
  6. $db_name = "dbperpus";
  7. $vcari   = $_POST['kode'];
  8. $koneksi = new mysqli($db_host, $db_user, $db_pass, $db_name);
  9.  
  10. if($koneksi->connect_error)
  11. {
  12.   echo "koneksi ke database Gagal..";
  13. }
  14. //else echo "koneksi Berhasil";
  15.  
  16. $cek=mysqli_select_db($koneksi,$db_name);
  17. ?>
  18. <h1 align="center" class="style1"><strong>DATA FINDCODE </strong><strong></strong></h1>
  19. <!-- ///////////////////////////// Script untuk membuat tabel///////////////////////////////// -->
  20.  
  21. <table Width='800'  border='1' align="center">  
  22. <tr>
  23.     <th> kode </th>
  24.     <th> Judul </th>
  25.     <th>Penulis</th>
  26.    </tr>
  27.  
  28. <?php  
  29. // Perintah untuk menampilkan data
  30. $hasil=MySQLi_query ($koneksi,"SELECT * FROM tbbuku WHERE judul LIKE '%$vcari%'") or die(mysqli_error());
  31.  
  32. // perintah untuk membaca dan mengambil data dalam bentuk array
  33. while ($data = mysqli_fetch_array ($hasil)){
  34.  echo "    
  35.        <tr>
  36.        <td>".$data['kode']."</td>
  37.        <td>".$data['judul']."</td>
  38.        <td>".$data['penulis']."</td>
  39.        </tr>
  40.        ";
  41.        
  42. }
  43.  
  44. ?>
  45. </table>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top