here is a snippet of my code using active record to update the item_stock values. I need to get the item.SKU from item table as selector to my query.
$this->db->join('item','item.item_id = items.item_id')
->join('items','items.stock_id = item_stock.stock_id')
->set('item_stock.stock_quantity','item_stock.stock_quantity + $new_qty',FALSE)
->where('item_stock.colour',$color)
->where('item_stock.size',$size)
->where('item.SKU',$SKU)
->update('item_stock');
$query = $this->db->update('item_stock');
for some reason it lost it's JOIN stack.
Error Number: 1054
Unknown column 'item.SKU' in 'where clause'
UPDATE `item_stock` SET `item_stock`.`stock_quantity` = item_stock.stock_quantity + $new_qty WHERE `item_stock`.`colour` = 'Kuning' AND `item_stock`.`size` = 'XL' AND `item`.`SKU` = 'Wooser-01'
Filename: E:\xampp\htdocs
ekogear\system\database\DB_driver.php
Line Number: 330
any tips how to overcome this problem? thanks before.
*ps = I've try the $this->db->query("query code here") and it works fine, but I want to use the active record style for the consistency.