PDA

View Full Version : My counter not working. Please take a look.


DawgieDog
01-04-2003, 08:05 AM
<%
Set conn = server.CreateObject("Adodb.connection")
Set rs = Server.CreateObject("Adodb.Recordset")
conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("db/emc.mdb") & ";"

sqlGetCount = "SELECT * FROM Counter"
rs.Open sqlGetCount, conn
Count = rs("Count")
NewCount = Count + 1
rs.Close
sqlAddCount = "INSERT INTO Counter (Count) VALUES (" & NewCount & ")"
rs.Open sqlAddCount, conn
Set rs = Nothing
conn.Close
Set conn = Nothing
%>

I dunno if I have to post the mdb file since when I open it all I see is rectangles like: [](but together). The problem with the counter is it got stuck at 2 visits, lol. Here is the code I'm putting in my source: <font color="#ffcc00" size="1">Visit Number:</font>&nbsp;<font color="#000000" size="1"><!--#include file="counter.asp" --><%=NewCount%></font>

Mhtml
01-04-2003, 09:59 AM
lol, What was I thinking. :confused:

<%
Set conn = server.CreateObject("Adodb.connection")
Set rs = Server.CreateObject("Adodb.Recordset")
conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("db/emc.mdb") & ";"

sqlGetCount = "SELECT * FROM Counter"
rs.Open sqlGetCount, conn
Count = rs("Count")
NewCount = Count + 1
rs.Close
sqlAddCount = "UPDATE Counter SET Count = " & NewCount
rs.Open sqlAddCount, conn
Set rs = Nothing
conn.Close
Set conn = Nothing
%>


Wrong SQL statement, I didn't pick up on it earlier. Just save that the counter.asp file and re-upload the mdb (database) to the "db" directory.

whammy
01-04-2003, 03:32 PM
Heheh... that would've been kind of a big database for a counter... ;)

I actually DO use an insert for my db counter, but that's because I'm tracking USER_AGENT, etc. as well, then I just get a sum of unique ip addresses for the count...

Mhtml
01-04-2003, 04:37 PM
I have 6 tables, I get a report on everything from the amount of times a specific person visits and for how long to the average browser count for any day of the week or for any month year or day of year. It's quite complex and I don't even need all that data.

I am thinking of marketing it, I have versions for access and sql or MySQL server.

Another cool thing which I have in it is the ability to print the report.

When I put it up on my server I'll throw ya the address. :D