我收到一个错误消息:
错误编号:1048列'ket'不能为空
插入到tb_uploadv
(ket
,tgl
,video
)值中(空,空,空)
文件名:/xamppV 5/htdocs/sicams/系统/数据库/数据库驱动程序. php
行号:691
请各位师傅帮帮我。
我的控制器:controllers/Uploadv.php
<?php
class Uploadv extends CI_Controller{
public function index(){
$data['uploadv'] = $this->m_uploadv->tampil_data()->
result();
$this->load->view('templates/header');
$this->load->view('templates/sidebarupv');
$this->load->view('uploadv', $data);
$this->load->view('templates/footer');
}
public function tambah_aksi()
{
$data = [
'ket' => $this->input->post('ket'),
'tgl' => $this->input->post('tgl'),
'video' => $this->input->post('video'),
];
$this->m_uploadv->input_data($data, 'tb_uploadv');
redirect('uploadv/index');
}
}
?>
我的观点:浏览/上传
<div class="content-wrapper">
<section class="container-fluid">
<h5>
Data Rekaman
<small>Silahkan Upload Data Rekaman</small>
</h5>
</section>
<section class="content">
<button class="btn btn-primary" data-toggle="modal" data-target="#exampleModal"><i class="fa fa-book"></i>Tambah Data</button>
<table class="table">
<tr>
<th>No</th>
<th>Keterangan</th>
<th>Tanggal Rekaman</th>
<th>File Rekaman</th>
</tr>
<?php
$no = 1;
foreach ($uploadv as $upv) : ?>
<tr>
<td><?php echo $no++ ?></td>
<td><?php echo $upv->ket ?></td>
<td><?php echo $upv->tgl ?></td>
<td><?php echo $upv->video ?></td>
</tr>
<?php endforeach; ?>
</table>
</section>
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">FORM UPLOAD REKAMAN</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form method="post" action="<?php echo base_url().'uploadv/tambah_aksi';?>">
<div class="form-group">
<label>Keterangan</label>
<input type="text" name="keterangan" class="form-control">
</div>
<div class="form-group">
<label>Tanggal Rekaman</label>
<input type="date" name="tanggal_rekam" class="form-control">
</div>
<div class="form-group">
<label>File Rekaman</label>
<input type="text" name="bukti" class="form-control">
</div>
<button type="reset" class="btn btn-danger"
data-dismiss="modal">Batal</button>
<button type="submit" class="btn btn-primary">Simpan</button>
</form>
</div>
</div>
</div>
</div>
</div>
我的模特:模特/模特儿_上传. php
<?php
class M_uploadv extends CI_Model {
public function tampil_data()
{
return $this->db->get('tb_uploadv');
}
public function input_data($data)
{
$this->db->insert('tb_uploadv', $data);
}
}
1条答案
按热度按时间j2cgzkjk1#
您正在提交具有另一个名称的输入字段,您输入的名称应匹配。
请尝试以下代码。