How to use the following SQL query:
update shop_items
set amount = amount + 1
where itemid = 123
Basically, in only one SQL query do you set amountto the previous value that it had, plus one.
No need for two queries; -)
Integrating this into your PHP code should give you something similar to this:
if (!$this->db->query('UPDATE shop_items SET amount=amount+1 WHERE itemid='.$itemid.'')) :
return false;
endif;
. _current_value_ , : amount.