我有这张桌子
id | part_number | desc | date |
1 | 3yrt3470 | aa | 2017-02-20 |
2 | 3utitj40 | bb | 2017-02-12 |
PK = ID
我想在表中创建查询插入,但如果存在part_number,它将更新。有人可以帮帮我吗? 我试过这个
function replace($part_number)
{
$this->db->replace('tbl_master_data');
$this->db->set('description',$description);
$this->db->set('rrp',$rrp);
$this->db->set('discount_code',$discount_code);
$this->db->set('product_group',$product_group);
$this->db->set('value_discount',$value_discount);
$this->db->set('stk',$stk);
$this->db->where('part_number',$part_number);
}
错误消息表明您必须使用'设置'方法...