Ok I looked at that and tried some things but I am still having some problems. No value gets entered in the table. All I see is 0000-00-00 00:00:00
If I response.write onlinedate before I format I see 1/13/2004 5:06:14 PM
If I response.write onlinedate after format I see 13-1-2004 17:6:14
I am using mysql and I am using the datetime type for the two columns Logon_time, Last_Seen
Here is my code
<!--#include file='dbconnection.inc'-->
<%
onlinedate = now()
OnlineUserIp = Request.ServerVariables("REMOTE_ADDR")
strUserID = Session("userName")
onlinedate = Day(onlinedate) & "-" & Month(onlinedate) & "-" & Year(onlinedate) & " " & Hour(onlinedate) & ":" & Minute(onlinedate) & ":" & Second(onlinedate)
lastseen = Day(onlinedate) & "-" & Month(onlinedate) & "-" & Year(onlinedate) & " " & Hour(onlinedate) & ":" & Minute(onlinedate) & ":" & Second(onlinedate)
'Set timeout in minutes
strTimeout = 5
StrOnlineTimedout = dateadd("n",-strtimeout*3,onlinedate)
StrSql = "Select * From Active_Users Where User_ID='" & strUserID & "'"
Set rs1 = adoCon.Execute (StrSql)
'Check if users id exists in active users database
if rs1.eof then
'Add user to database because they dont exist
StrSql = "INSERT INTO active_Users (Logon_time,User_ip,Last_Seen,Last_Page,User_ID) " &_
"VALUES ('" & onlinedate & "','" & OnlineUserIp & "','" & lastseen & "','" &_
request.servervariables("path_info") & "','" & strUserID & "')"
adoCon.Execute (StrSql)
else
'There Still active so lets update their info
StrSql = "UPDATE active_users SET Last_Seen='" & lastseen & "', Last_Page='" &_
request.servervariables("path_info") & "' WHERE User_ID='" & strUserID & "'"
adoCon.execute (StrSql)
end if
'Remove Users Who Have Timed Out
StrSql = "DELETE FROM active_users WHERE Last_Seen < " & StrOnlineTimedout &"
adoCon.execute (StrSql)
%>