Im trying to write a cookie to clients machines and then test for the existence of the cookie as a way of counting unique hits. Something is wrong but i cant tell what. Here's what i did. FIrst i check for the existence of the cookie and if its not there i increment the counter and write the cookie (here is the code):
<cfif not isdefined("Cookie.visitedsurvey"
>
<cfquery name="updateUnique"
datasource="mydb"
dbtype="ODBC">
UPDATE counter
SET uniqueVisitors = (uniqueVisitors + 1)
WHERE page = 'survey'
</cfquery>
<cfcookie name="visitedsurvey" value="" expires="30">
</cfif>
</cflock>
for some reason, the uniqueVisitors field increments up every time i refresh the page. Anyone know why? (my browser does accept cookies)
<cfif not isdefined("Cookie.visitedsurvey"
<cfquery name="updateUnique"
datasource="mydb"
dbtype="ODBC">
UPDATE counter
SET uniqueVisitors = (uniqueVisitors + 1)
WHERE page = 'survey'
</cfquery>
<cfcookie name="visitedsurvey" value="" expires="30">
</cfif>
</cflock>
for some reason, the uniqueVisitors field increments up every time i refresh the page. Anyone know why? (my browser does accept cookies)