Advertisement
Guest User

Untitled

a guest
Nov 18th, 2018
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.65 KB | None | 0 0
  1. <?php
  2. $user="root";
  3. $pass="";
  4. $host="localhost";
  5. $dbnamne="neardeal";
  6.  
  7. $store_id = $_REQUEST['store_id'];
  8.  
  9. //create connection
  10. $conn = new mysqli($host, $user, $pass, $dbnamne);
  11.  
  12. //check connection
  13. if($conn->connect_error){
  14.     die("connection failed" .$com->connect_error);
  15. }
  16.  
  17. //[nama formula menghitung 2 titik koordinat : mysql great circle distance]
  18.  
  19. //$sql = "SELECT * FROM store";
  20. $sql = "SELECT *FROM product WHERE store_id={$store_id}";
  21.  
  22. $result = $conn->query($sql);
  23. $data = array();
  24.  
  25. while($row =$result->fetch_assoc()){
  26.     $data[]=$row;
  27. }
  28.  
  29. echo json_encode(array(
  30.     'success' => true,
  31.     'products' => $data
  32. ));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement