rootasuna

RestApi_Json

Apr 7th, 2019
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. <?php
  2. header('Content-Type: application/json');
  3. include 'hakata.php';
  4. $query = mysql_query("SELECT * FROM masakan");
  5. $jumlah=mysql_num_rows($query);
  6. $lihat= array();
  7. while($l=mysql_fetch_array($query)){
  8. $lihat[] = array(
  9. "Nama Masakan"=>$l["nama_masakan"],
  10. "Harga"=>$l["harga"]);
  11. }
  12. $data = array(
  13. "jumlah"=>$jumlah,
  14. "data"=>$lihat);
  15. $json = json_encode($data);
  16. echo $json;
  17. ?>
Advertisement
Add Comment
Please, Sign In to add comment