当我尝试在模型中显示基于 $ nip 的数据时出现错误,当我按下查看按钮时如何获取 $ nip 数据
遇到未捕获的异常类型:ArgumentCountError 消息:函数 Berkas_model::getPengajuanKG() 的参数太少,在第 419 行的 C:\xampp\htdocs\pkl\application\controllers\Data.php 中传递了 0,而预期的文件名正好为 1: C:\xampp\htdocs\pkl\application\models\Berkas_model.php 行号:125
这是代码内联编号 125
public 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');
}
当我点击查看按钮时
<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>
跃然一笑