There is no way to know if a user is still reading your forum. HTTP is a stateless environment, which means that when someone requests a document you only have knowlegde of them until the document has been set to them. They could sit reading it for 3 days and you wouldn't know. Or they could type in another URL and be gone in 1 second.
The best you can hope to do is set a cookie when they enter the forum and update your table. Then if they click on another page on your site outside of the forum then you can read and adjust the cookie and update the table. However this won't help if someone types in a new URL and leaves your site that way. For that I'd suggest that you put a timestamp with the entry saying they are in the forum, and have that table clean out entries over 1hr old every time someone logs in.