CoverYourASP --> Advertising --> Part 4: The BannerStats table

Free membership

Join in the fun! Sign in
Member Services

Site navigation
Download the entire site!
Search my articles
Free Magazines
Browse the directory

Send me feedback
Buy my boxer shorts

Recommend this page
Printer-friendly page

Resources I recommend
Link to my site
Advertising slashed!
About your privacy
Legal stuff
Site statistics
8 active users
1286 visitors today
2158 pages today
how is this done?
Tools I use

CoverYourASP
Copyright © 1999-2013 James Shaw.
All rights reserved.

ASP.NET Blog
RSS submissions
E-commerce

Now open source with SourceForge!

The BannerStats table

In Part 3 we saw how BannerCounter.asp incremented the fields in the BannerStats table, but where did the record come in the first place? That's what we'll look at now.

Remember the BrandNewDay( ) function in utils/Init.asp that's called once per day or whenever we want to put the days banners into Application variables? That also has the following code in it:

// now create new entries in BannerStats table for today
for ( var i=0; i<nBanners; i++ )
{
   // see if it already exists
   DBGetRecords ( 'SELECT BannerID FROM BannerStats WHERE BannerDate=' + sDate + ' AND BannerID=' + nBannerIDs [ i ] );

   // create it if it doesnt exist
   if ( oRecordSet.EOF )
      oConnection.Execute ( 'INSERT INTO BannerStats (BannerDate,BannerID) VALUES (' + sDate + ',' + nBannerIDs [ i ] + ')' );
}

"nBanners" contains the number of banners that will be rotated through the day - for each banner I need to create a new record in the BannerStats table every day.

First I test if the record already exists for that banner and todays date. If it doesn't then I obviously create one. This code is called at the start of every day, and can also be called manually by me when adding new banners.

And that's that. From top to bottom, how I added advertising to CoverYourASP! Now you can do it too...

Featured sponsor
My favorite resources


I share my content

Supporting ASPRSS

Do you need a quick and easy way to link to my articles? All the information you need is published with ASPRSS...


New Proposal Kit Professional 5.1
Brand yourself as a top professional: create quotes and amazing proposals and get many legal documents free!

The latter saved me 3 times the purchase price on the first day I owned it!