Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- define('DB_HOST', 'localhost');
- define('DB_USER', 'id10192535_razitul');
- define('DB_PASSWORD', 'hoki7878');
- define('DB_NAME', 'id10192535_rumah_sakit');
- $conn = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
- if(mysqli_connect_errno()){
- echo 'Gagal terhubung ke database MySQL Server'. mysqli_connect_error();
- die();
- }
- $stat = $conn ->prepare("SELECT id,nama,alamat,nohp,website,latitude,longtitude,gambar FROM data ");
- $stat ->execute();
- $stat ->bind_result($id,$nama,$alamat,$nohp,$website,$latitude,$longtitude,$gambar);
- $rumahsakit = array();
- while ($stat ->fetch()){
- $temp = array();
- $temp['id']= $id;
- $temp['nama']= $nama;
- $temp['alamat']= $alamat;
- $temp['nohp']= $nohp;
- $temp['website']= $website;
- $temp['latitude']= $latitude;
- $temp['longtitude']= $longtitude;
- $temp['gambar']= $gambar;
- array_push($rumahsakit, $temp);
- }
- echo json_encode($rumahsakit);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement