Print Page | Close Window

UPDATE SQL

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=5611
Printed Date: 30 March 2026 at 9:39pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: UPDATE SQL
Posted By: Gullanian
Subject: UPDATE SQL
Date Posted: 08 September 2003 at 2:51pm
Hi guys, im doing a simple counter which updates 1 every page view, works fine on my PWS, when I upload to gearhost it makes the counter go up by 2 each time!  Anyone know why?



Replies:
Posted By: michael
Date Posted: 08 September 2003 at 3:19pm
No.

-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: michael
Date Posted: 08 September 2003 at 3:20pm
Oh but maybe someone know if you post some code....

-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: Gullanian
Date Posted: 08 September 2003 at 4:57pm

Dim statCurrYear

Dim statCurrMonth

Dim statCurrDay

Dim statCurrHour

Dim intCoolInt 'S

Dim intCoolInt2 'pv

statCurrYear = year(now())

statCurrMonth = month(now())

statCurrDay = day(now())

statCurrHour = hour(now())

'Do statistics

strSQL = "SELECT * from tblStats WHERE statYear = " & statCurrYear & " AND statMonth = " & statCurrMonth & " AND statDay = " & statCurrDay & " AND statHour = " & statCurrHour

rsCommon.open strSQL, adoCon

'Create if none exist

If rsCommon.eof or rsCommon.bof then

rsCommon.close

strSQL = "INSERT INTO tblStats (statYear,statMonth,StatDay,StatHour,sessions,pageViews) VALUES (" & statCurrYear & "," & statCurrMonth & "," & statCurrDay & "," & statCurrHour & ",0,0)"

rsCommon.open strSQL, adoCon

else

intCoolInt = rsCommon("sessions")

intCoolInt2 = rScommon("pageViews")

intCoolInt = intCoolInt+1

intCoolInt2 = intCoolInt2+1

rsCommon.close

end if

strSQL = "UPDATE tblStats SET pageViews = " & intCoolInt2

If isEmpty(Session("blnCounterSet")) = True Then

strSQL = strSQL + (", sessions = " & intCoolInt)

end if

strSQL = strSQL + (" WHERE statYear = " & statCurrYear & " AND statMonth = " & statCurrMonth & " AND statDay = " & statCurrDay & " AND statHour = " & statCurrHour)

rsCommon.open strSQL, adoCon

'Total session count

If isEmpty(Session("blnCounterSet")) = True Then

strSQL = "UPDATE tblConfiguration SET sessions = " & lngSessions + 1

rscommon.open strSQL, adoCon

Session("blnCounterSet") = True

End if

strSQL = "UPDATE tblConfiguration SET pageviews = " & lngPageViews + 1

rscommon.open strSQL, adoCon

%>

messy code coz i kept fiddling with other methods to try and get it to work!



Posted By: Gullanian
Date Posted: 08 September 2003 at 6:10pm

this is where it all happens:

http://www.drum-world.com/stats.asp?m=9&y=2003 - http://www.drum-world.com/stats.asp




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net