Session variable not being picked up in database query
I've got a page where I use a recordset to filter records based on the userID session variable of the currently logged in user.
I know the session variable is being populated properly because I have it displaying on the web page (the session variable is set after the user logs in using a page protected by SA).
However, when I use this session variable in my WHERE clause in a recordset it is not being detected and when I write the SQL statement to the page the value always appears as -1 (the default value that should be being overwritten with the session variable value).
I've attached my page and added PHP comments above the lines that are either not working properly or lines where php code is written to the screen for debugging purposes. I can't figure out why the session variable is not being picked up in my WHERE clause.