一点代码片段:
$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');
我想做的是:
- 从装备主中删除行,其中 id = $outfit_id
- 从 suit_products 中删除 suit_id = $outfit_id 的行
- 从 suit_images 中删除 suit_id = $outfit_id 的行
但实际上当我添加最后两行时:
$this->db->where('outfit_id', $outfit_id);
$this->db->delete('outfit_images');
*它也会从 suit_main 中删除所有行。为什么?*