this code works! it puts the 1 in field "online" if i will open asp file with that code alone and i will enter this asp with session it will give me "1" perfectly! dim mysql, connasa, connstringasa Set connasa = Server.CreateObject("ADODB.Connection") ConnStringasa = "Driver={MySQL ODBC 3.51 Driver};Server=mySQL4.domain.com;database=user;user=user;password=pass;OPTION=3" Connasa.Open ConnStringasa if Session("usernameid")<>"" then vab=Session("usernameid") mySQL="UPDATE crmagents SET online=1 WHERE username='" & vab & "'" connasa.execute(mySQL) end if Connasa.close Code (markup): but when i put the same code in the global.asa like this <script language="vbscript" runat="server"> Sub Session_OnStart dim mysql, connasa, connstringasa Set connasa = Server.CreateObject("ADODB.Connection") ConnStringasa = "Driver={MySQL ODBC 3.51 Driver};Server=mySQL4.domain.com;database=user;user=user;password=pass;OPTION=3" Connasa.Open ConnStringasa if Session("usernameid")<>"" then vab=Session("usernameid") mySQL="UPDATE crmagents SET online=1 WHERE username='" & vab & "'" connasa.execute(mySQL) end if Connasa.close set Connasa=nothing end sub </script> Code (markup): when i enter pages with the right sessions...i got nothing...just like it not works... why? whyyyy me?
the problem is that when the user login and and get the Session("usernameid") the globla.asa not recognize the session... i tested it 2 ways- to give the Session("usernameid")=username and only than to redirect the page and the second way i first redirected the user and only then on the redirected page i gave Session("usernameid")=session("username") and on the global i changed the "if" into: if Session("usernameid")<>"" or Session("username")<>"" then