Advertisement
RyanRain

api

Jan 3rd, 2019
448
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.53 KB | None | 0 0
  1. <?php
  2. include_once "koneksi.php";
  3.     header('Content-Type: application/json');
  4.    
  5. if($_SERVER['REQUEST_METHOD']=='POST') {
  6.   $search = $_POST['search'];
  7.   $sql = "SELECT * FROM tbrs where nama LIKE '%$search%' and bpjs = '1'";
  8.   $res = mysqli_query($con,$sql);
  9.   $result = array();
  10.   while($row = mysqli_fetch_array($res)){
  11.     array_push($result, array('nama'=>$row[1], 'gambar'=>$row[2], 'lat'=>$row[3], 'lng'=>$row[4], 'detail'=>$row[5]));
  12.   }
  13.   echo json_encode(array("value"=>1,"result"=>$result));
  14.   mysqli_close($con);
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement