View difference between Paste ID: hQiWHeSS and sEF2DY33
SHOW: | | - or go back to the newest paste.
1
<?php
2
include "config.php";
3
4-
$data=array();
4+
$data = array();
5
6-
$cek_kode=mysqli_query($konek, "select content_title, input_date, content_desc from content where is_news = 1");
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);
8+
$cek = mysqli_num_rows($cek_kode);
9-
if ($cek_kode==0){
9+
if ($cek_kode == 0)
10-
		echo "Tidak ada koleksi";
10+
11-
		}
11+
    echo "Tidak ada koleksi";
12
}
13
else
14-
while ($hasil=mysqli_fetch_array($cek_kode, MYSQLI_ASSOC))
14+
15
    while ($hasil = mysqli_fetch_array($cek_kode, MYSQLI_ASSOC))
16-
$row=[];
16+
    {
17-
foreach($hasil as $nm=>$val) $row[$nm]= trim($val);  
17+
        $row = [];
18-
$data[]=$row;
18+
        foreach ($hasil as $nm => $val)
19
        {
20
            $row[$nm] = utf8_encode ( $val );
21-
die(json_encode($data));
21+
        }
22
        $data[] = $row;
23-
?>
23+
24
    }
25
    die(json_encode($data));
26
}
27
?>
28