I have set up a session variable for the Users ID when the user logs in - here's the code:
<cflock timeout=999 scope="Session" type="Exclusive">
<cfset Session.IDUsers = "">
</cflock>
Then I am trying to use this session variable to insert the Users ID into another table called 'Comments' when the users add a comment - though it is not working, here's my code for the insert comment + sessionvariable:
<cfquery ...>
INSERT INTO comment (.... IDUsers)
VALUES (...info ...)
SELECT IDUsers
FROM users
WHERE users.IDUsers = <cfqueryparam value="#Session.IDUsers#">
</cfquery>
Though this isn't working. Here's the error -
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT IDUsers FROM users WHERE users.IDUsers = ''' at line 9.
Anyone know what I'm to do?