Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

colums in table not updating

public function validateloginAction($uname, $password){

        $user = Tbluser::findfirst("user_id = '$uname' AND user_password='$password' AND user_status='active'");
        if(!$user){
           echo"username or password error";
        }
        else{
            $datetoday = date("Y-m-d H:i:s"); 
            $user = Tbluser::findfirst("user_id = '$uname'");

            $updatelogin = $user->user_lastlogin = '$datetoday';
            if(!$updatelogin){
                echo"error in updating record";
            }

            return $this->forward('product/addproduct');
        }    
    }

my user_lastlogin that has a DATETIME datatype in my tbluser is not updating its value.



1.5k
Accepted
answer
edited Jul '14

You need to save it:

$user->user_lastlogin = $datetoday;
if(!$user->save()){
    echo"error in updating record";
}
edited Jul '14

wow many thanks bro.