Advertisement
agung_indra_wijaya

fungsi

Apr 26th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. <?php
  2.  
  3. $con= mysqli_connect("localhost","root","agung_110793","TA_PenjualanBuku");
  4.  
  5. if (mysqli_connect_errno() ){
  6. echo "Failed to eonnect to mysql:" . mysqli_connect_errno();
  7. }
  8.  
  9. function pencarian(){
  10.  
  11. if (isset($_GET['Search'])){
  12.  
  13. $search_query = $_GET['user_query'];
  14.  
  15. $cek = "SELECT * FROM buku where searching like '%$search_query%' ";
  16.  
  17. $run_query = mysqli_query($con,$cek);
  18.  
  19. while ($cari=mysqli_fetch_array($run_query)){
  20.  
  21. $judul = $cari['judul_buku'];
  22. $harga = $cari['harga'];
  23. $pro_brand = $cari['discount_buku'];
  24. $pro_title = $cari['tahun_terbit'];
  25. $pro_price = $cari['bahasa'];
  26. $pro_image = $cari['gambar_buku'];
  27.  
  28. echo "
  29. <div id='single_product'>
  30.  
  31. <h3>$judul</h3>
  32.  
  33. <img src='admin/buku_images/$pro_image' width='180' height='180' />
  34.  
  35. <p> <b> Rp. $harga </b> </p>
  36.  
  37. <a href='datails.php?pro_id=$pro_id' style='float:left;' >Details</a>
  38.  
  39.  
  40. <a href='index.php?pro_id=$pro_is'><button style='float:right'>Add to cart</button></a>
  41.  
  42. </div>
  43.  
  44.  
  45.  
  46.  
  47. ";
  48.  
  49. }
  50.  
  51. }
  52. }
  53.  
  54.  
  55.  
  56. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement