I can't figure out how to update my last inlog time

后端 未结 2 649
伪装坚强ぢ
伪装坚强ぢ 2021-01-26 15:46

I\'m trying to make an last activity function for an website. but i can\'t get it to work. I hope you guys can help me out here.

this is my query:

$last         


        
相关标签:
2条回答
  • 2021-01-26 16:21

    Your logic is incorrect. Use this:-

    "UPDATE users_table SET 'date_last_inlog' = NOW() WHERE user_name  = '$user_name'";
    

    You are using this :-

    UPDATE users_table SET user_name  = '$user_name' WHERE 'date_last_inlog' = NOW()
    

    You are trying to update user_name column where the date_last_inlog column value is equal to the current time which is logically incorrect.

    0 讨论(0)
  • 2021-01-26 16:23

    Your SQL query is in the wrong order.

    $last_activity_query = "UPDATE users_table SET 'date_last_inlog' = NOW() WHERE user_name  = '$user_name'";
    
    0 讨论(0)
提交回复
热议问题