Tom,
The way I handle this is to has is to have the href be a redirect page which
increments the counter and then sends them to new url.. For example:
<a href="grabclicks.cfm?id=#id#&url=#urlencodedformat(url)#"
target="_new">#url#</a>
with grabclick.cfm being:
<cfparam name="url.url" default="">
<cftry>
<cfstoredproc datasource="#request.datasource#"
procedure="usp_IncrementCounter" >
<cfprocparam cfsqltype="CF_SQL_VARCHAR" dbvarname="url" type="In"
value="#url.url#">
<cfprocparam type="In" cfsqltype="CF_SQL_INTEGER" dbvarname="id"
value="#url.id#" null="No">
</cfstoredproc>
<cfcatch>
</cfcatch>
</cftry>
<cflocation url="#url.url#">
The stored proc just increments the counter for that url and that customer
(in case you have multiple customers calling the same url). Also notice that
the error trapping basically ignores all errors so the link doesnt break if
somebody hacks the url
(see http://www.vawter.com/urlhack.cfm for a discussion of my recent battles
with that)
HTH
Don
----- Original Message -----
From: "Tom Forbes" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Friday, July 06, 2001 10:07 PM
Subject: How do I increment counter field by clicking on link?
> Help Please -
>
> 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??
>
> Thanks very much!
>
> Tom
>
>
>
>
>
>
> *******************************************************
> MedMatrix Used Medical Equipment Web Portal
> http://www.medmatrix.com
> V:(407) 772-3427 F:(407) 772-3428
> Tom Forbes, Forbes Web Consulting, Inc.
> 178 S. Monterey Isle Blvd., Longwood, FL - 32779
> *******************************************************
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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