We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

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.



2.0k
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.