Advertisement
abuzuhair

get all store

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