Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Online Members Problem
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

h1dd3n
New Member

92 Posts

Posted - 13 January 2005 :  13:32:41  Show Profile
Hi, I currently have this code that will display the online users as a list, unfortunately it does not seem to work and instead gives me an error; below i have provided the code and also the error - can anyone see any obvious mistakes in the coding by any chance that I may have missed out on?
From what I can see it does not add anything into the database thus causing the error.(looked into database and no new records have appeared)

quote:
<%
function mySqlDate(myDate)

mySqlDate = Year(myDate) & "-" & Month(myDate) & "-" & Day(myDate) & " " & Hour(myDate) & ":" & Minute(myDate) & ":" & Second(myDate)

end function
%>
<%
set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open MM_db_sweda1825_STRING
onlinedate = mySqlDate(now())

OnlineUserIp = Request.ServerVariables("REMOTE_ADDR")
strUserStatus = rs_memberstat.Fields.Item("MEMBER_STATUS").Value
strUserIcon = rs_memberstat.Fields.Item("MEMBER_ICON").Value

'Set timeout in minutes
strTimeout = 1
StrOnlineTimedout = dateadd("n",-strtimeout*3,mySqlDate(onlinedate))
strOnlineTimedout = mySqlDate(StrOnlineTimedout)

StrSql = "Select * From general_online Where GENONLINE_USERNAME='" & 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 general_online (GENONLINE_LOGON,GENONLINE_IP,GENONLINE_LASTSEEN,GENONLINE_USERNAME,GENONLINE_STATUS,GENONLINE_ROOM,GENONLINE_IMG) " &_
"VALUES ('" & onlinedate & "','" & OnlineUserIp & "','" & mySqlDate(now()) & "','" & strUserID & "','" & strUserStatus & "','1','" & strUserIcon & "')"
adoCon.Execute (StrSql)
else
'There Still active so lets update their info
StrSql = "UPDATE general_online SET GENONLINE_LASTSEEN='" & mySqlDate(now()) & "', Last_Page='" &_
request.servervariables("path_info") & "' WHERE GENONLINE_USERNAME='" & strUserID & "'"
adoCon.execute (StrSql)
end if

'Remove Users Who Have Timed Out
StrSql = "DELETE FROM general_online WHERE GENONLINE_LASTSEEN < " & StrOnlineTimedout & ""
'adoCon.execute (StrSql)

%>


quote:
ADODB.Field error '800a0bcd'

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

members/mem_online.asp, line 101


Edited by - h1dd3n on 16 January 2005 18:29:08

DarkDrift
Junior Member

USA
126 Posts

Posted - 13 January 2005 :  17:44:08  Show Profile  Visit DarkDrift's Homepage  Send DarkDrift an AOL message
Check your DB that error is saying that there are No Records to your SELECT. If you have info in your DB i would check the code to make sure that the Table Names are Correct. Plus if your users are using this you may want to add. this error can also come from updating nothing!


If rs.BOF or rs.EOF then
Response.Write("No Active users")
else
YOUR CODE
end if


http://www.xcalliber.com - The Future of Boards

Edited by - DarkDrift on 13 January 2005 17:44:44
Go to Top of Page

h1dd3n
New Member

92 Posts

Posted - 14 January 2005 :  05:55:03  Show Profile
it doesnt seem to add anything into the database it seems, I login and it doesnt show any active users in the database.
Ive checked the database table names but to no avail.
Im thinking theres a code error that prevents the INSERT command.
Go to Top of Page

h1dd3n
New Member

92 Posts

Posted - 18 January 2005 :  14:51:54  Show Profile
anyone got any advances on this?
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 18 January 2005 :  23:24:16  Show Profile
Do you have any On Error Resume Next statements in your page code that might be hiding and error message?

======
Doug G
======
Computer history and help at www.dougscode.com
Go to Top of Page

h1dd3n
New Member

92 Posts

Posted - 19 January 2005 :  11:29:16  Show Profile
err no i dont it seems.
i may need to ad one from the looks of it:
where would I put it so it'll parse the whole page?
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 19 January 2005 :  21:17:21  Show Profile
On Error Resume Next does error trapping. You don't want any such statements while you're debugging your code.

======
Doug G
======
Computer history and help at www.dougscode.com
Go to Top of Page

h1dd3n
New Member

92 Posts

Posted - 20 January 2005 :  10:54:52  Show Profile
oh...

jeese! this is pi**ing me off! i haveno idea whats causing this and its sloly turning me into dispair!
Go to Top of Page

Podge
Support Moderator

Ireland
3775 Posts

Posted - 20 January 2005 :  13:47:40  Show Profile  Send Podge an ICQ Message  Send Podge a Yahoo! Message
I don't see where strUserID gets set to a user id.

This should return nothing because strUserID is nothing.

StrSql = "Select * From general_online Where GENONLINE_USERNAME='" & strUserID & "'"

This is the sql that gets executed
Select * From general_online Where GENONLINE_USERNAME=''

Podge.

The Hunger Site - Click to donate free food | My Blog | Snitz 3.4.05 AutoInstall (Beta!)

My Mods: CAPTCHA Mod | GateKeeper Mod
Tutorial: Enable subscriptions on your board

Warning: The post above or below may contain nuts.
Go to Top of Page

h1dd3n
New Member

92 Posts

Posted - 20 January 2005 :  15:01:18  Show Profile
sorry, didnt copy above the page.
its already assigned but at the very top of the page.

<%
Dim strUserID
strUserID = Session("sess_username")
%>
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.27 seconds. Powered By: Snitz Forums 2000 Version 3.4.07