sys_input; foreach ($a_data as $d) { $d["obv_json"] = json_encode($d["obv"]); unset($d["obv"]); $qry = $this->db->insert("ttv_dummy.incoming", $d); if (!$qry) { echo json_encode([ "status" => "ERR", "message" => "Err incoming " . $this->db->error()["message"] ]); exit; } } echo json_encode(["status" => "OK", "message" => ""]); } function qry() { $data = $this->sys_input; $medrec = $data["medrec"]; $sql = "select * from ttv_dummy.xorder where medrec = ?"; $qry = $this->db->query($sql,[$medrec]); if (!$qry) { echo json_encode([ "status" => "ERR", "message" => "Err incoming " . $this->db->error()["message"] ]); } $rows = $qry->result_array(); if (count($rows) == 0) { echo json_encode([ "status" => "E01", "message" => "Patient not found" ]); exit; } echo json_encode(["status"=>"OK", "data"=> $rows[0]]); } }