How would I create the following statement in MySQL/CodeIgniter?
Update the current value of “food” with variable $sell. So the result would be the value of “food” + $sell.
EDIT: Ok, I finally figured it out using CodeIgniters Active Record Class
$food_up = "food +" . $sell;
$this->db->set('food', $food_up, FALSE)
->where('user_id', $uid);
$this->db->update('market');
Thank you for your suggestions 😉
Your solution is going to be a combination of an
updateand modifying the result usingstring literalsand variables in MySQL.You are going to need to figure out how to “set” your column to the current value + a string literal. Your question does look a little confusing and its hard to tell if you actually need a variable or not, or if you are just appending something to the current value…