|
Hello everybody.
Does anyone know why this code doesn't work well?
It is sending data to my .mdb file, that is not the problem.
But is doesn't display data on the page. I want to display the number of visitors with graphics.
Thank you very much!!!
<%
Dim Conn
Dim RS
Dim TotalVisited
Dim ImgSequence
Dim CharToReplace
Dim Query
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("hit_counter.mdb")
Set RS = Server.CreateObject("ADODB.Recordset")
Query = "SELECT * FROM Hits WHERE Hit_IP='" & Request.ServerVariables("REMOTE_ADDR") & "' AND Hit_Date=#" & DATE() & "#"
RS.Open Query, Conn, 3, 3
IF RS.EOF AND RS.BOF THEN
RS.AddNew
RS("Hit_Date") = Date()
RS("Hit_Time") = Time()
RS("Hit_IP") = Request.ServerVariables("Remote_Addr")
RS.Update
END IF
RS.Close
Select Case Request.QueryString ("Mode")
Case "Graphic"
RS.Open "SELECT COUNT (*) AS TotalVisits FROM Hits", conn, 3, 3
If Not RS.Eof and NOT RS.Bof Then
TotalVisits = Rs("TotalVisits")
RS.Close
For I = 1 to Len (TotalVisits)
CharToReplace = Mid(TotalVisits, I, 1)
ImgSequence = ImgSequence & "<img src='" & CharToReplace & ".gif' Border=0>"
Next
Response.Write ImgSequence
Else
Response.Write "<img src='/forum/0.gif' border=0>"
End If
End Select
%>
|
|
|
|
|
|
|
|