Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(!empty($_POST['type'])){
- $type = $_POST['type'];
- $name = $_POST['name_startsWith'];
- $query = "SELECT `id_barang`, `nama_barang`, `jumlah_all` FROM `tabel_barang` where UPPER($type) LIKE '".strtoupper($name)."%'";
- $result = $this->db->query($query)->result_array();
- $data = array();
- foreach ($result as $row) {
- if ($row['jumlah_all']=='')
- {
- echo "<script>
- alert ('data kosong');
- </script>"
- }
- else
- {
- $name = $row['id_barang'].'|'.$row['nama_barang'].'|'.$row['jumlah_all'];
- array_push($data, $name);
- }
- }
- echo json_encode($data);
- }
Advertisement
Add Comment
Please, Sign In to add comment