Hi,
I have the following asp page that processes data submitted from links in other pages.
The point is to count the hits from the link on a particular page. It reads the city and site variable and adds the clicks in increments. However currently it wont add by city, only by site and even then it will only do it once. It also needs to check to see if the site and corresponding city are already in a row in the database, and if so just add 1 to the click.
Hope this kind of makes sense.
Thanks!
I have the following asp page that processes data submitted from links in other pages.
Code:
<%
'declare variables passed from links
SiteURL = Request.QueryString("URL")
site = Request.QueryString("site")
city = Request.QueryString("city")
If Len(SiteURL) > 0 Then
Set objConn = CreateObject("ADODB.Connection")
objConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("clicks.mdb"))
' If the URL is already in the database an error will be thrown and we perform an UPDATE
' Instead of a INSERT.
on error resume next
objConn.Execute "INSERT INTO SiteClicks(site,city,thisdate,clicks) VALUES('" & site & "' , '" & city & "', '" & date & "', 1)"
If Err.Number <> 0 Then
'objConn.Execute "UPDATE SiteClicks SET city = '" & city & "'"
objConn.Execute "UPDATE SiteClicks SET clicks = clicks + 1 WHERE site='" & site & "' AND WHERE city='" & city & "'"
'objConn.Execute "UPDATE SiteClicks SET thisdate = '" & date & "'"
End If
objConn.Close
Set objConn= Nothing
Response.redirect SiteURL
End If
%>
The point is to count the hits from the link on a particular page. It reads the city and site variable and adds the clicks in increments. However currently it wont add by city, only by site and even then it will only do it once. It also needs to check to see if the site and corresponding city are already in a row in the database, and if so just add 1 to the click.
Hope this kind of makes sense.
Thanks!