Hello,
I created a module wich makes it possible to place banners on a website.
Basicly it works like this:
in the manager the admin can upload an image (jpg, gif) and fill in a form with information like the company, the url where the banner should redirect to and so on.
You can place a banner like this: [[Banner? &width=200 &height=113]]
Then all the banners with the given width and height are loaded and randomly one is placed.
This works fine. But I would like to be able to see how often a banner is shown on an page and how often is clicked.
The clicked part works fine but the view-part is where it goes wrong.
The code:
$sql2 = "UPDATE banners set view = ’".($row[’view’]+1)."’, viewtotal = ’".($row[’viewtotal’]+1)."’, geplaatst = 1 WHERE id = ".$row[’id’];
For some reason this code is executed 4 times. The banner is only displayed one time, but the update number of views part executes 4 times.
How is this possible?
-
☆ A M B ☆
- 24,524 Posts
I would imagine that on your test system you’ve got 4 qualifying banners, and that query gets executed during the random selection process, or in some other way it gets executed once for each possible banner.
Do you use the preview tab after editing a document?