【发布时间】:2019-03-04 07:14:53
【问题描述】:
很痛苦,表列不是空值。我的表列“值”不为空。因为我需要它。这就是为什么我将它设置为不为空。当我从其他第三方同步数据时,一些值是空的并且它发生了。因此,如果 null 如何设置为列。
这里我的控制器代码都可以,只需要插入,如果为空也插入空,但表列不需要设置为空。
$sync_history = array();
$sync_history['total_sync_record'] = $records['count'];
$sync_history['module'] = $records['module'];
$sync_history['sync_time'] = $records['time'];
$sync_history['sync_by'] = $records['user'];
$sync_history['way'] = $records['way'];
$sync_history['sync_type'] = 'Manual';
$sync_history['operation_type'] = 'Insert';
$sync_history['value'] = $records['value'];
$this->db->insert('sync_data', $sync_history);
这是问题$sync_history['value']。如果可能,不要在 mysql 中将列更改为 null。
谢谢
【问题讨论】:
标签: jquery mysql codeigniter