How could I simplify this update instruction? Whenever a client buys an item it will update the sales with 1.
$this->db->query('SELECT amount FROM shop_items WHERE itemid='.$itemid.'');
$new_amount = $item->amount+1;
if(!$this->db->query('UPDATE shop_items SET amount='.$new_amount.' WHERE itemid='.$itemid.'')):
return false;
endif;
Can't I make it more simple so there are less lines, for example:
if(!$this->db->query('UPDATE shop_items SET amount=_current_value_+1 WHERE itemid='.$itemid.'')):
return false;
endif;
is this possible? if not thanks anyway