|
A PHP Error was encounteredSeverity: Notice
Message: Object of class CI_DB_mysql_result could not be converted to int
Filename: models/iteminfo.php
Line Number: 22
代码如下:
PHP复制代码 function updateRecords ($data){
$this->db->where('item_number',$data['item_number']);
//$this->db->where('item_name',$data['item_name']);
//$this->db->where('item_spec',$data['item_spec']);
$this->db->where('item_wh',$data['item_wh']);
$query = $this->db->get('iteminfo'); // 22 行
if ($query->num_rows() > 0 ){
$row = $query->row();
$price = ($row->item_price + $data['item_price'])/2;
$amount = $row->item_amount + $data['item_amount'];
$item_update = array(
'item_number' => $data['item_number'] ,
'item_name' => $data['item_name'] ,
'item_spec' => $data['item_spec'] ,
'item_unit' => $data['item_unit'] ,
'item_price' => $price,
'item_amount' => $amount,
'item_date' => $data['item_date'] ,
'item_wh' => $data['item_wh'] ,
);
$this->db->update('iteminfo',$item_update);
}else{
$this->addRecords($data);
}
} 复制代码 |
|