Just put a CFQUERY in the link's template:

<CFQUERY>
update myTable
set Visits = Visits + 1
where companyID = #companyID#
</CFQUERY>

Of course, this will be executed whenever this template is called up, whether 
by this hyperlink, some other hyperlink, form submittal, or directly.  If you 
need to update Visits only when this particular hyperlink is clicked, add a 
parameter to the hyperlink and check for the existence of that parameter in the 
link's template.  If that parameter exists, call the update query:

<a href="http://#WebAddress#?fromLink=true"; ...>

<CFIF IsDefined("URL.fromLink")>
<CFQUERY>update....</CFQUERY>
</CFIF>

-David

On Friday, July 06, 2001 9:08 PM, Tom Forbes [SMTP:[EMAIL PROTECTED]] 
wrote:
> I have a database table with company information, and a field called
> "Visits" -
>
> The below link appears in the left hand frame panel. When clicked, the
> visitor sees the company's web site in the right hand frame (bottomright).
>
> <A href="http://#WebAddress#"; TARGET="bottomright">#CompanyName#</a>
>
> I want to increment the "Visits" field by one count every time the link is
> clicked. I have tried many approaches, but am unable to resolve this - can
> someone please help me??

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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