|
数据库执行删除操作的时候,第一次老是出错,出错提示部分信息: "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中相关代码如下:PHP复制代码 [color=rgb(0, 0, 128)][backcolor=rgb(247, 250, 255)][font=Consolas][size=9.8pt][b]public function [/b][/size][/font][/backcolor][/color][color=#000]delArticle($cid = false){
[/backcolor][backcolor=#f7faff] if ($cid){
[/backcolor][backcolor=#f7faff] $cid=explode(',',$cid);
[/backcolor][backcolor=#f7faff] if (count($cid)){
[/backcolor][backcolor=#f7faff] $this->whereIn('id',$cid)->delete();
[/backcolor][backcolor=#f7faff] return true;
[/backcolor][backcolor=#f7faff] }else{
[/backcolor][backcolor=#f7faff] return false;
[/backcolor][backcolor=#f7faff] }
[/backcolor][backcolor=#f7faff] }else{
[/backcolor][backcolor=#f7faff] return false;
[/backcolor][backcolor=#f7faff] }
[/backcolor][backcolor=#f7faff]
[/backcolor][color=rgb(0, 0, 0)][backcolor=rgb(247, 250, 255)][font=Consolas][size=9.8pt]}[/size][/font][/backcolor][/color]
复制代码
controller中相关代码如下:
PHP复制代码 [color=rgb(102, 0, 0)][backcolor=rgb(247, 250, 255)][font=Consolas][size=9.8pt]$ArticleModel [/size][/font][/backcolor][/color][color=#000]= new ArticleModel();
[color=#6600]$id=$this->request->getPost('id');
[/backcolor][color=rgb(102, 0, 0)][backcolor=rgb(247, 250, 255)][font=Consolas][size=9.8pt]$dnum[/size][/font][/backcolor][/color][color=#000]=$ArticleModel->delArticle($id); 复制代码
请哪位大佬帮忙看看,谢谢!
|
|