In Chapter 7, “Connecting Your Web Site to a Database,” we briefly demonstrated how to insert a dynamic image into a details page. While it’s great to be able to draw images from a database and display them on the page, there may come a time when you don’t want the visitor to see the same image every time he loads the page. The answer is dynamic, rotating images.
Probably the most common use for rotating images on the Internet is ad banners. More and more sites are setting aside a little bit of desktop real estate to sell products, promote services, and entice visitors with special deals. Since these banner ads are most often controlled by a database, the site owners are capable of tracking the number of times the banner has been displayed and even the number of times it has been clicked. And the great thing about storing the banner ad information in a database is the fact that the Web developer only need specify which images should be displayed and where the image should go when clicked. The code and database take care of the rest.