kura2yamato

perbaikan 115

Oct 20th, 2020
494
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. include "config.php";
  3.  
  4. $data = array();
  5.  
  6. $cek_kode = mysqli_query($konek, "select content_title, input_date, content_desc from content where is_news = 1");
  7.  
  8. $cek = mysqli_num_rows($cek_kode);
  9. if ($cek_kode == 0)
  10. {
  11.     echo "Tidak ada koleksi";
  12. }
  13. else
  14. {
  15.     while ($hasil = mysqli_fetch_array($cek_kode, MYSQLI_ASSOC))
  16.     {
  17.         $row = [];
  18.         foreach ($hasil as $nm => $val)
  19.         {
  20.             $row[$nm] = utf8_encode ( $val );
  21.         }
  22.         $data[] = $row;
  23.  
  24.     }
  25.     die(json_encode($data));
  26. }
  27. ?>
  28.  
RAW Paste Data