Forums
This topic is locked
Statistics count
Posted 02 Jan 2002 21:54:29
1
has voted
02 Jan 2002 21:54:29 David Behan posted:
Can anyone tell me how get a statistic count of how many times a certain .asp page has been viewed. Everytime that a page is viewed a new record is added to the database with the time and date??? If I have that information I think that I could build a statistics section in the backend of the site so that users can view what pages are being viewed most.Cheers...
Replies
Replied 03 Jan 2002 01:30:41
03 Jan 2002 01:30:41 Owen Eastwick replied:
Use Command (Stored Procedure) then select Insert from the Type list.
Then set up the isert statement using this format:
INSERT INTO YourTableName(FieldName) Values(YourValue)
Dont worry about the YourValue part too much put in Anything for now e.g. ('Dummy'). Remember Text must have single quotes numeric values none.
Then modify the code on the page like so:
<%
set Command1 = Server.CreateObject("ADODB.Command"
Command1.ActiveConnection = MM_YourConnectionStringName_STRING
Command1.CommandText = "INSERT INTO YourTableName(YourFieldName) VALUES ('" & Now() & "')"
Command1.CommandType = 1
Command1.CommandTimeout = 0
Command1.Prepared = true
Command1.Execute()
%>
This will insert the current date and time into a text field within the database every time the page is loaded.
Regards
Owen.
Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
Then set up the isert statement using this format:
INSERT INTO YourTableName(FieldName) Values(YourValue)
Dont worry about the YourValue part too much put in Anything for now e.g. ('Dummy'). Remember Text must have single quotes numeric values none.
Then modify the code on the page like so:
<%
set Command1 = Server.CreateObject("ADODB.Command"
Command1.ActiveConnection = MM_YourConnectionStringName_STRING
Command1.CommandText = "INSERT INTO YourTableName(YourFieldName) VALUES ('" & Now() & "')"
Command1.CommandType = 1
Command1.CommandTimeout = 0
Command1.Prepared = true
Command1.Execute()
%>
This will insert the current date and time into a text field within the database every time the page is loaded.
Regards
Owen.
Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo