Postingan lainnya
Codeigniter
mau bertanya, bagaimana cara mengatasi A Database Error Occurred Error Number: 1054 Unknown column 'surat_kuasa' in 'field list' INSERT INTO `pengajuan` (`no_rm`, `nama`, `nama_asuransi`, `tata_usaha`, `kelengkapan`, `surat_kuasa`, `surat_pelepasan_informasi`, `surat_ke_direktur`, `kib`, `rm`) VALUES ('19007800', 'A', 'PT Asuransi Axa Mandiri Finansial Service', '2020-04-01', '1', '1', '1', '1', '1', '2020-04-02') Filename: C:/xampp/htdocs/e-pasti/system/database/DB_driver.php Line Number: 691 source code simpan saya seperti ini
function simpan(){
$data = array(
'no_rm' =>$this->input->post('norm'),
'nama' =>strtoupper($this->input->post('namapasien')),
'nama_asuransi' =>$this->input->post('asuransi'),
'tata_usaha' =>$this->input->post('tanggalsurat'),
'kelengkapan' =>$this->input->post('kelengkapan'),
'surat_kuasa' =>$this->input->post('surat_kuasa'),
'surat_pelepasan_informasi' =>$this->input->post('surat_pelepasan_informasi'),
'surat_ke_direktur' =>$this->input->post('surat_ke_direktur'),
'kib' =>$this->input->post('kib'),
'rm' => date('Y-m-d')
);
if(!empty($data['no_rm'])){
$kematian = $this->db->get_where('kematian', ['norm'=>$data['no_rm']]);
$mati = $kematian->num_rows();
$row = $kematian->row_array();
if($mati > 0){
$no_mati = $row['no_urut_simpan'];
}else{
$no_mati = '';
}
}
$simpan = $this->db->insert('pengajuan',$data);
if($simpan){
$row = $this->db->get_where('config', ['id'=>1])->row_array();
$printer = $row['value'];
if($row['status']==1){
$handle = printer_open($printer);
if($handle){
printer_start_doc($handle, "My Document");
printer_start_page($handle);
$font = printer_create_font("Tahoma", 30, 20, 400, false, false, false, 0);
printer_select_font($handle, $font);
printer_draw_text($handle, "ASURANSI", 70, 0);
printer_delete_font($font);
$font = printer_create_font("Tahoma", 25, 10, 400, false, false, false, 0);
printer_select_font($handle, $font);
printer_draw_text($handle, "No RM : ".$data['no_rm'], 5, 60);
printer_draw_text($handle, "Nama : ".$data['nama'], 5, 90);
printer_draw_text($handle, "Tgl : ".date('d-m-Y'), 5, 120);
if($mati > 0){
printer_draw_text($handle, "Meniggal: ".$row['tahun_meninggal'].' + '.$row['no_urut_simpan'], 5, 150);
}
printer_draw_text($handle, "Dokter : ", 5, 180);
printer_draw_text($handle, "------------------------------------------------------------", 5, 300);
printer_end_page($handle);
printer_end_doc($handle);
printer_close($handle);
}
}
1 Jawaban:
Halo astirin,
Mohon Izin Menjawab,
Ada karakter yang tidak dapat dicetak (RecordSeparator) disisipkan antara surat_kuasa dan tanda saat INSERT. Hapus saja teksnya (
surat_kuasa`) dan tulis ulang dengan tangan maka itu akan baik-baik saja.
Semoga dapat terjawab,
Sumber: <a href='https://stackoverflow.com/questions/15989529/unknown-column-in-field-list-but-column-does-exist/43632412'>https://stackoverflow.com/questions/15989529/unknown-column-in-field-list-but-column-does-exist/43632412</a>