deepson2 Posted May 21, 2009 Share Posted May 21, 2009 Hello, I want to show users status that weather he/she is online or not. so i have added one column last_access with type datetime i am ding this because if without logged in user just closed his/her browser then,i wont be able to figure out whether he/she is online or not. so using datatime, i can select user who is logged in last 15 minute. but i am just no able to figure out what i am doing wrong here. here is my query $update = $op->runsql("UPDATE ".tbl_author." SET last_access = '".date('Y-m-d H:i:s')."' WHERE id = '$uid'"); if(mysql_num_rows($update) > 0){ } $result = $op->runsql("SELECT TIMESTAMPDIFF(MINUTE, a.last_access, NOW()) >15 from ".tbl_author." as a where a.id ='$uid"); if(mysql_num_rows($result) > 0){ echo "online"; }else{ echo "offline"; } can anyone help me, how can i achive this? thnaks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/159075-online-or-offline-query/ Share on other sites More sharing options...
trq Posted May 21, 2009 Share Posted May 21, 2009 but i am just no able to figure out what i am doing wrong here. You might at least explain your results to us. Quote Link to comment https://forums.phpfreaks.com/topic/159075-online-or-offline-query/#findComment-838909 Share on other sites More sharing options...
deepson2 Posted May 21, 2009 Author Share Posted May 21, 2009 You might at least explain your results to us. its not showing me anything neither online nor offline Quote Link to comment https://forums.phpfreaks.com/topic/159075-online-or-offline-query/#findComment-838915 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.