Hi,
I am trying to make a counter, which writes the input to a db. This works fine
on single pages (index.cfm, etc.). However, I am confused on how to get this to
work on a actionpage, which queries the db for 100s of articles. The app in
question is at http://cfhawaii.com/nutrition_media/youngheart.cfm It is
basically a master detail page set up. If you go to the page there are 8 links
to articles which links to
http://cfhawaii.com/nutrition_media/complete_article_page55.cfm?article_id=1
where the article is by id. The code below counter all views,a nd I am trying
to figure out how to just count the view per id??
Thanks so much,
John
<!--- Counter Code--->
<cfquery name="gethits" datasource="my_datasource">
SELECT hit_count
FROM hitcounter
</cfquery>
<cfif gethits.recordcount IS 0>
<cfquery name="inserthit" datasource="my_datasource">
INSERT INTO hitcounter ( hit_count) VALUES (1)
</cfquery>
<cfelse>
<center><b>No. of viewers: </b><cfoutput query="gethits"><font
size="+2">#hit_count#</font></cfoutput> </center>
</cfif>
<cfquery name="updatehits" datasource="my_datasource">
UPDATE hitcounter
SET hit_count = hit_count + 1
</cfquery>t by 1 --->
UPDATE hitcounter
SET hit_count = hit_count + 1
</cfquery>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k
Archive:
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:3668
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15