two basic things you want to do are easy... and also how much php do you know...
the flow would go something like this...
you might want a more better like randomizer, and do error checking and other such things
/// get your database connection
function showBanner()
{
$query = "
SELECT banner_image
FROM BannerTable
ORDER BY RAND() LIMIT 1;";
$result = mysql_query($query);
$row = mysql_fetch_array($result, MYSQL_ASSOC)
return "<img src='{$row['banner_image']}' />";
$query = "
UPDATE BannerTable
SET num_views = num_views + 1
WHERE banner_image='{$row['banner_image']}';";
mysql_query($query);
}
echo "This is a banner". showBanner() ."<br/>";
This is also assuming you have a table with atleast
CREATE TABLE BannerTable
(
banner_image VARCHAR(100),
num_views BIGINT Unsigned
)