public function save() { if ($this->input->is_ajax_request()) { $data = $this->input->post('data'); if (!empty($data)) { //check exist $is_exist = $this->patient->check_e0_exist($this->hospcode, $data['hn'], to_mysql_date($data['date_serv']), $data['diagcode']); if (!$is_exist) { $data['e0_hosp'] = $this->get_e0_hosp($this->hospcode) + 1; $data['e1_hosp'] = $this->get_e1_hosp($this->hospcode, $data['code506']) + 1; $data['amp_code'] = $this->amp_code; $data['addrcode'] = $data['changwat'] . $data['ampur'] . $data['tambon'] . $data['moo']; $age = get_current_age(to_mysql_date($data['birth'])); $data['agey'] = $age['year']; $data['agem'] = $age['month']; $data['aged'] = $age['day']; $data['hserv'] = $this->hserv; $rs = $this->patient->save($data); if ($rs) { //update status $this->patient->updat_waiting_status($data['id'], '2'); $json = '{"success": true}'; } else { $json = '{"success": false, "msg": "ไม่สามารถบันทึกรายการได้"}'; } } else { $json = '{"success": false, "msg": "รายการซ้ำ"}'; } } else { $json = '{"success": false, "msg": "ไม่พบข้อมูลที่ต้องการบันทึก"}'; } render_json($json); } else { show_error('No ajax.', 404); } }
<th>Emergency Number</th> <th>Description</th> </tr> ENDBLOCK; $sql = "select c.first_name,c.last_name,c.nickname,c.image_filename," . "c.gender,c.birthdate,p.first_name,p.last_name,p.secondary_phone,c.emergency_name," . "c.emergency_phone,pgm.description from parent p,child c,program pgm,enrollment e " . "where c.parent_id = p.id and pgm.id=e.program_id and e.program_id=6 and " . "e.child_id = c.id group by e.program_id,e.child_id;"; $result = mysqli_query($db, $sql); if (mysqli_num_rows($result) > 0) { while ($row = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row[0] . "</td>"; echo "<td>" . $row[1] . "</td>"; echo "<td>" . $row[2] . "</td>"; echo "<td><img width=80 src=" . "imag__pics/" . $row[3] . "></td>"; echo "<td>" . $row[4] . "</td>"; echo "<td>" . get_current_age($row[5]) . "</td>"; echo "<td>" . $row[6] . "</td>"; echo "<td>" . $row[7] . "</td>"; echo "<td>" . $row[8] . "</td>"; echo "<td>" . $row[9] . "</td>"; echo "<td>" . $row[10] . "</td>"; echo "<td>" . $row[11] . "</td>"; echo "</tr>"; } } echo "</table>"; mysqli_close($db); ?> </div>