Welcome Guest, Not a member yet? Register   Sign In
MySQL Add one to integer in field.
#1

[eluser]Bramme[/eluser]
Code:
$query = "UPDATE `sd_story_suggestions` SET `approvals` =  `approvals` + 1 WHERE `id` = '$suggestion_id'";
$this->db->query($query);

Any way to do this with ActiveRecord? It works fine like this, but I was just wondering.
#2

[eluser]w0bbes[/eluser]
+1 for your signature Smile
#3

[eluser]Armchair Samurai[/eluser]
I suppose set the third parameter to FALSE when calling set()

Code:
$this->db->set('approvals', 'approvals + 1', FALSE);
$this->db->where('id', $suggestion_id);
$this->db->update('sd_story_suggestions');




Theme © iAndrew 2016 - Forum software by © MyBB