【问题标题】:Error Number: 1292 Truncated incorrect DOUBLE value in my SQL error错误号:1292 在我的 SQL 错误中截断了不正确的 DOUBLE 值
【发布时间】:2018-10-01 03:09:51
【问题描述】:

我有这样的显示错误 1292 截断不正确的 DOUBLE 值 这是我在代码点火器模型中的删除操作功能代码

public function delete_marks($s_id){
           $this->db->where_not_in('student_id', $s_id);
           return  $this->db->delete('student_marks');
       }

及其显示错误

错误号:1292
截断不正确的 DOUBLE 值:'305,304'
DELETE FROM student_marks WHERE student_id NOT IN ('305,304')

因为在这部分'305,304'单个配额' '自动添加 所以它显示1292错误 如何解决?

【问题讨论】:

  • $this->db->where_not_in('student_id',explode(',', $s_id));

标签: php mysql codeigniter mysqli


【解决方案1】:

看起来你的$s_id 是字符串。在 CI 中,where_not_in 或 where_in 你必须传递数组。

public function delete_marks($s_id){
    $s_id = explode(",", $s_id);
    $this->db->where_not_in('student_id', $s_id);
    return  $this->db->delete('student_marks');
}

【讨论】:

    【解决方案2】:

    在where_not_in 中你必须传递一个数组。

    public function delete_marks($s_id){
        $this->db->where_not_in('student_id',explode(',', $s_id));
        return  $this->db->delete('student_marks');
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-12-31
      • 2020-10-26
      • 2013-04-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-14
      • 1970-01-01
      相关资源
      最近更新 更多