huanwuying 发表于 2020-5-27 16:11:46

CI4 数据库删除操作问题

数据库执行删除操作的时候,第一次老是出错,出错提示部分信息:    "title": "mysqli_sql_exception",    "type": "mysqli_sql_exception",
    "code": 500,
    "message": "Unknown column 'art_type' in 'OLD'",
    "file": "F:\\xampp\\htdocs\\test\\myapi\\ci\\vendor\\codeigniter4\\framework\\system\\Database\\MySQLi\\Connection.php",
    "line": 331,
    "trace": [   {            "file": "F:\\xampp\\htdocs\\test\\myapi\\ci\\app\\Models\\Article\\ArticleModel.php",
            "line": 88,
            "function": "delete",
            "class": "CodeIgniter\\Model",
            "type": "->",
            "args": []
      },
...................

model中相关代码如下:public function delArticle($cid = false){
    if ($cid){
      $cid=explode(',',$cid);
      if (count($cid)){
                $this->whereIn('id',$cid)->delete();
            return true;
      }else{
            return false;
      }
    }else{
      return false;
    }

}



controller中相关代码如下:
$ArticleModel = new ArticleModel();
$id=$this->request->getPost('id');
$dnum=$ArticleModel->delArticle($id);

请哪位大佬帮忙看看,谢谢!


huanwuying 发表于 2020-5-27 16:22:38

已处理完毕,数据库触发器问题
页: [1]
查看完整版本: CI4 数据库删除操作问题