php - 查询错误:列不能为空 - 查询无效
问题描述
我在方法 get 中使用代码 php 在“tr_no_hp”列中发布,例如
$nomorhp = $this->input->get('nomor_hp');
但是在我尝试插入数据库列后不能为空。如何解决这个问题
这是我的控制器代码
$nomorhp = $this->input->get('nomor_hp');
$data = array(
'us_id' => $this->user->us_id,
'sv_id' => $voucher->sv_id,
'op_id' => $voucher->op_id,
'tr_id_plgn' => $nomor,
'tr_no_hp' => $nomorhp,
);
$this->db->insert('transaksi', $data);
$trx_id =$this->db->insert_id();
我得到了这个错误代码
Query error: Column 'tr_no_hp' cannot be null - Invalid query: INSERT INTO `transaksi`
谢谢
解决方案
推荐阅读
- python - 如何为 pandas to_csv 设置行分隔符
- sql-server - SSDT 不会在未解析的引用上引发编译错误
- paypal - 如何在 PayPal 沙盒中测试重复/自动付款配置文件的失败、跳过付款?
- python - 使用 shapely、geopandas 和索引在 python 中连接网格的质心
- javascript - 如果所选选项为空,如何防止提交?
- javascript - RxJS 管道过滤到 2+ 个分支
- arrays - Mongoose 返回一个空数组
- android - 如何处理android布局中的不同分辨率?
- node.js - Electron 主进程 - 无法在 Windows 上获取用户输入
- java - Java:在 finalize() 中抛出异常的影响