webapp user control

Hello

I need to control which users are logged into my xojo webapp.
I’m currently using a boolean field in mysql, but when the user close browser i can’t set the field to False.

there is a better way to do this?

On session.Close

  DIM DB As NEW MySQLCommunityServer

'....conection code here

 SESSION.UserID

DB.SQLExecute "UPDATE myUSERS SET ONLINE=0 WHERE myUSERS .IF=" + session.UserID 'HERE I RECEIVE AN NIL OBJECT ERROR
DB.close

what is the “.IF” for. it wont cause the exception, just my SQL curiosity.

I use the same thing in my session.close event

have you got the session.UserID as a property in session? I am sure you have however it works for me so have to check.

Are you using XOJO? I am still using RealStudio, give it a try there you might have found a undocumented change/bug.

Have a great day
Damon

‘IF’ is a reserved command in MySQL, so if you want to use it as a field name you need to surround it with quotes:

DB.SQLExecute "UPDATE myUSERS SET ONLINE=0 WHERE `IF` = " + str(session.UserID)

Also you don’t need to use myUSERS.IF since you have already addressed it as the table name.