> > <cfquery name="GetCounter"...
> >     SELECT HitCount
> >     From...
> > </cfquery>
> > <cfset Counter = GetCounter.HitCount + 1>
> > <cfquery name="UpdateCounter"...
> >     UPDATE ...
> > </cfquery>
> 
> You really need to make things like that a transaction 
> (cftransaction). Think what happens if your current value 
> was 2, and two ppl came at once, read 2 from the database, 
> and both write 4 back... you've missed a hit.

Or, even better, write it within a single query. You can probably just do
this:

UPDATE mytable SET HitCount = HitCount + 1 ...

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to