bes*_*rld 4 php activerecord codeigniter
一点代码片段:
$this->db->where('id', $outfit_id);
$this->db->update('outfit_main',$data);
//Delete productsettings for specific outfit (They are added below with new values)
$this->db->where('outfit_id', $outfit_id);
$this->db->delete('outfit_products');
//Delete outfit_images for specific outfit as well. They are also added below
$this->db->where('outfit_id', $outfit_id);
$this->db->delete('outfit_images');
Run Code Online (Sandbox Code Playgroud)
我想做的是:
但实际上当我添加最后两行时:
$this->db->where('outfit_id', $outfit_id);
$this->db->delete('outfit_images');
Run Code Online (Sandbox Code Playgroud)
*它也会删除outfit_main中的所有行.为什么?*
尝试将where子句与delete活动记录组合:
$this->db->delete('outfit_main', array('id' => $outfit_id));
$this->db->delete('outfit_products', array('outfit_id' => $outfit_id));
$this->db->delete('outfit_images', array('outfit_id' => $outfit_id));
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7178 次 |
| 最近记录: |