Advertisement
Guest User

Untitled

a guest
Mar 3rd, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. $db_username = 'xxxxx';
  2. $db_password = 'xxxx';
  3. $db_name = 'xxxx';
  4. $db_host = 'localhost';
  5. $item_per_page = 9;
  6.  
  7. $mysqli = new mysqli($db_host, $db_username, $db_password, $db_name);
  8. if ($mysqli->connect_error) {
  9. die('Error : ('. $mysqli->connect_errno .') '. $mysqli->connect_error);
  10. }
  11.  
  12. $page_number = filter_var($_POST["page"], FILTER_SANITIZE_NUMBER_INT, FILTER_FLAG_STRIP_HIGH);
  13.  
  14. if(!is_numeric($page_number)){
  15. header('HTTP/1.1 500 Invalid page number!');
  16. exit();
  17. }
  18.  
  19. $position = (($page_number-1) * $item_per_page);
  20.  
  21. $results = $mysqli->prepare("select * FROM inserting_discount_product ORDER BY id DESC LIMIT ?, ?");
  22.  
  23. $results->bind_param("dd", $position, $item_per_page);
  24.  
  25. $results->execute(); //Execute prepared Query
  26.  
  27. $results->bind_result($pro_id, $pro_title,
  28. $pro_cat,$pro_desc,$pro_price,$pro_img,$pro_discount_price,$pro_discount_percent
  29. age,$product_code);
  30.  
  31.  
  32. while($results->fetch()){
  33. echo "
  34. <div id='$pro_id' class='col-md-3 col-sm-4 col-xs-12'>
  35.  
  36. <h3 style='color:black'; align='center'>$pro_title</h3>
  37. <div>
  38.  
  39. <img src='../admin_area/product_images/product_pics/$pro_img' width='180' height='180' /> <br>
  40. </div>
  41.  
  42.  
  43. <p style='color:black;margin-right:12px'><b>Price: $ $pro_discount_price </b>
  44.  
  45. <span style='color:black;text-decoration:line-through;margin-left:15px'>
  46. <b style='color:red'>Price: $ $pro_price</b>
  47. </span>
  48.  
  49. </p>
  50.  
  51. <a href='details.php?pro_id=$pro_id' style='margin-right:10px' class='detail_hover'><b>Details</b></a>
  52. <span style='font-weight:bolder'>$pro_discount_percentage %</span>
  53. <a href='index.php?add_cart=$pro_id&product_code=$product_code' style='color:orange;margin-left:10px' class='basket-logo'>
  54. <span class='fa fa-shopping-cart fa-2x'></span></a>
  55.  
  56.  
  57. </div>
  58.  
  59. ";
  60.  
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement