當(dāng)我嘗試在模型中顯示基于 $ nip 的數(shù)據(jù)時(shí)出現(xiàn)錯(cuò)誤,當(dāng)我按下查看按鈕時(shí)如何獲取 $ nip 數(shù)據(jù)遇到未捕獲的異常類型:ArgumentCountError 消息:函數(shù) Berkas_model::getPengajuanKG() 的參數(shù)太少,在第 419 行的 C:\xampp\htdocs\pkl\application\controllers\Data.php 中傳遞了 0,而預(yù)期的文件名正好為 1: C:\xampp\htdocs\pkl\application\models\Berkas_model.php 行號(hào):125這是代碼內(nèi)聯(lián)編號(hào) 125public function getPengajuanKG($nip){ $query = "SELECT * FROM `tbl_berkas` WHERE `id_jenis_berkas` = 'KP1' OR `id_jenis_berkas` = 'SK1' OR `id_jenis_berkas` = 'SK2' AND `nip` = '$nip' "; return $this->db->query($query)->result_array();}在控制器中public function cetak_kp(){ $data['title'] = 'Kenaikan Pangkat'; $data['user'] = $this->db->get_where('tbl_user', ['nip' => $this->session->userdata('nip')])->row_array(); $data['pengajuan'] = $this->berkas_model->getPengajuanKG(); $this->load->view('templates/header', $data); $this->load->view('templates/sidebar', $data); $this->load->view('templates/topbar', $data); $this->load->view('approve/cetak_kp', $data); $this->load->view('templates/footer');}當(dāng)我點(diǎn)擊查看按鈕時(shí)<tr><th scope="row"><?= $i; ?></th><td><?= $b['nip']; ?></td><td><?= $b['nama_pegawai']; ?></td><td><?= tanggal('d F Y', $b['tanggal_pengajuan']); ?></td><td align="center"><a href="<?php echo base_url('data/cetak_kp/' . $b['nip']) ?>" class="btn btn-success btn-sm"><i class="fas fa-check"></i></a></td></tr>
1 回答

躍然一笑
TA貢獻(xiàn)1826條經(jīng)驗(yàn) 獲得超6個(gè)贊
你有方法聲明:
public function getPengajuanKG($nip)
接受 1 個(gè)參數(shù)。在這里,您可以不帶參數(shù)地調(diào)用該方法:
$data['pengajuan'] = $this->berkas_model->getPengajuanKG();
你應(yīng)該為你的方法添加參數(shù):
$nip = 'something you need to assign to this variable';
$data['pengajuan'] = $this->berkas_model->getPengajuanKG($nip);
- 1 回答
- 0 關(guān)注
- 150 瀏覽
添加回答
舉報(bào)
0/150
提交
取消