I am using a header hook to randomly select a banner image from DB for each page.
The hook needs to be able to select 1 random banner for each of the 3 different size spaces.
The problem i am having is:
I created the first hook for the top banner and everything worked as expected.
to select banner:
$headerBanner = $db->fetchRow('SELECT * FROM `banner_ads` WHERE ... ');
$query = $db->execute('UPDATE `<ezrpg>banner_ads` SET ... WHERE `id`=$headerBanner->id');
$tpl->assign('headerBanner', $headerBanner);
to display banner:
<img src="{$headerBanner->image}" alt="{$headerBanner->alt_text}" border="0" />
Next i duplicated the hooks to select the 2 other banners.. and found each hook is now being run twice and 2 banner impressions are being added for each page view.
i have logged to .txt file and 100% certain,
1 banner = 1 impression
2 banners = 2 impressions each
any ideas what going on here please?