query("SELECT kd_strip,nama_strip FROM strip ORDER BY nama_strip"); if($data->num_rows > 0) { $idx = 0; while($ket = $data->fetch_array(MYSQLI_ASSOC)) { $harray[$idx] = array('kd_strip' => $ket['kd_strip'],'nama_strip' => $ket['nama_strip']); $idx += 1; } /* tutup hasil query */ $data->close(); } /* tutup koneksi */ $mysqli->close(); /* cetak hasil */ echo json_encode($harray);