cruxaders Posted March 7, 2011 Share Posted March 7, 2011 Anyone can help me how to get the time when log.in and the time when log.out then it will store in database... tnx Link to comment https://forums.phpfreaks.com/topic/229882-hot-get-time-and-put-in-database/ Share on other sites More sharing options...
beegro Posted March 7, 2011 Share Posted March 7, 2011 Could you post some of your code? It's hard to help if we can't see the problem. Link to comment https://forums.phpfreaks.com/topic/229882-hot-get-time-and-put-in-database/#findComment-1184025 Share on other sites More sharing options...
cruxaders Posted March 7, 2011 Author Share Posted March 7, 2011 I still dnt have any codes for it im still searching in net on how to get the current time using PHP.... if anyone have idea..feel free to reply and help me Link to comment https://forums.phpfreaks.com/topic/229882-hot-get-time-and-put-in-database/#findComment-1184037 Share on other sites More sharing options...
litebearer Posted March 7, 2011 Share Posted March 7, 2011 Have you looked here?... http://php.net/manual/en/function.time.php Link to comment https://forums.phpfreaks.com/topic/229882-hot-get-time-and-put-in-database/#findComment-1184040 Share on other sites More sharing options...
ohdang888 Posted March 7, 2011 Share Posted March 7, 2011 #on login, run this query: mysql_query("UPDATE user_table SET last_login = NOW() ")or die(mysql_error()); #on logout, run this query: mysql_query("UPDATE user_table SET last_logout = NOW() ")or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/229882-hot-get-time-and-put-in-database/#findComment-1184041 Share on other sites More sharing options...
cruxaders Posted March 7, 2011 Author Share Posted March 7, 2011 ohdang8888 that was nice... i have a little question regarding with ur codes user_table = table name and last_login = the field name where the time will save... how about on the database i have.. should my log.in field looks like this Field name = login types = datetime Null = no Default = none sorry for my noob question.. and btw tnx to all Link to comment https://forums.phpfreaks.com/topic/229882-hot-get-time-and-put-in-database/#findComment-1184049 Share on other sites More sharing options...
ohdang888 Posted March 7, 2011 Share Posted March 7, 2011 i have a little question regarding with ur codes user_table = table name and last_login = the field name where the time will save... how about on the database i have.. should my log.in field looks like this Field name = login types = datetime Null = no Default = none yup that's all right Link to comment https://forums.phpfreaks.com/topic/229882-hot-get-time-and-put-in-database/#findComment-1184058 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.