Forums

ASP

This topic is locked

counting page loads

Posted 21 Feb 2007 16:39:06
1
has voted
21 Feb 2007 16:39:06 Rob dalton posted:
i have a database and use asp to display musicians details. I want to show musicians how many times their page hass been viewed. I created a field in my database called pageviews. how do i update and display how many times the page has been viewed

Replies

Replied 22 Feb 2007 08:52:15
22 Feb 2007 08:52:15 Dave Clarke replied:
ok, assuming you are using the Goto Detail Page behaviour to get to the page with the musicians details, this is how i would do it.
On the details page:-

<pre id=code><font face=courier size=2 id=code> &lt;%
varViews= CLng(Request.QueryString("fldmusicianID")
%&gt;
&lt;%

Set addviews = Server.CreateObject ("ADODB.Command"
addviews.ActiveConnection = MM_connstring_STRING
addviews.CommandText = "UPDATE tablename SET pageviews =pageviews+1 WHERE fldmusicianID="&varViews &""
addviews.CommandType = 1
addviews.CommandTimeout = 0
addviews.Prepared = true
addviews.Execute()

%&gt;</font id=code></pre id=code>

DW8.02|ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome.
www.reunite.co.uk

Reply to this topic