Welcome Guest, Not a member yet? Register   Sign In
Active Record: add +1 to current value (update)
#4

[eluser]wyl_g[/eluser]
i am having some trouble with this code. it keeps writing 1 in my database and if i remove the +1 it doesn't change/update the password. and if i remove the +1 and false params, i get a 1054 error. please help



function set_password($id, $password){

$this->db->set('password', $password +1, false);
$this->db->where('id', $id);
$this->db->update('workers');

if ($this->db->affected_rows() == '1')
{
return true;
}
return false;

}//end set password


Messages In This Thread
Active Record: add +1 to current value (update) - by El Forum - 04-07-2011, 10:07 AM
Active Record: add +1 to current value (update) - by El Forum - 04-07-2011, 10:30 AM
Active Record: add +1 to current value (update) - by El Forum - 04-07-2011, 10:46 AM
Active Record: add +1 to current value (update) - by El Forum - 05-28-2011, 10:50 AM
Active Record: add +1 to current value (update) - by El Forum - 05-28-2011, 01:21 PM
Active Record: add +1 to current value (update) - by El Forum - 05-28-2011, 01:43 PM
Active Record: add +1 to current value (update) - by El Forum - 05-28-2011, 02:38 PM



Theme © iAndrew 2016 - Forum software by © MyBB