there is an article on this site that explains how to do this.
you add a field to the database named shows and then when a banner shows you increment that field.
then you create a little function like this to retrieve
$sql = "SELECT shows FROM banners";
$query = mysql_query($sql);
$num = mysql_num_rows($query);
$total = 0;
for($i=0;$i<$num;$i++) {
$total += mysql_result($query,$i,0);
} //end for
$epoch = ceil($total/$num);
if(!$total%$num) {$epoch++;}
$sql = "SELECT id from banners WHERE shows<$epoch ORDER BY rand LIMIT 0,1";