Put them into temporary page-level variables and lock them when transferring the values, so that you don't have to lock the query -- that is bad practice. Something like this:
<cflock scope = "Session" timeout = "20" type = "readonly"> <cfset variables.temp = SESSION.user_ID> </cflock> <cfquery name="get_expired" datasource="#request.DSN#"> SELECT User_ID, nickname, expiry_date FROM tbl_client WHERE user_id=#variables.temp# </cfquery> As to your second situation, you could use the same approach: <cflock scope = "Session" timeout = "20" type = "readonly"> <cfset variables.temp = SESSION.user_ID> </cflock> <input type="hidden" name="user_id" value="<cfoutput>#variables.temp#</cfoutput>"> tom www.basic-ultradev.com "Seamus Campbell" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]... > I'm still confused over locking! > > I have this sort of query > <cfquery name="get_expired" datasource="#request.DSN#"> > SELECT User_ID, nickname, expiry_date > FROM tbl_client > WHERE user_id=#SESSION.user_ID# > </cfquery> > > I should lock the #SESSION.user_ID# but am I right in thinking that locking > the whole query is wasteful? > > If so how do I get around this? > > What are the best practices? > > And what about hidden fields in forms eg > <input type="hidden" name="user_id" > value="<cfoutput>#SESSION.User_id#</cfoutput>"> > > Lock the whole form? > Lock just the above line?? > > Any help would be appreciated (I have looked at Jim Schley's Best Practices > article and Ben Forta's article but they have confused me on the above 2 > points) > > Many thanks > > Seamus > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists