Se los agradeceria mucho
Código PHP:
<?php
include("db.php");
$qbaney = mysql_query("SELECT * FROM tabla");
mt_srand(time());
$max = mysql_num_rows($qbaney);
$rand = mt_rand(1,$max);
$sqldo = mysql_query("SELECT * FROM tabla WHERE ban_id='$rand'");
while($ban = mysql_fetch_assoc($sqldo))
{
echo "<a href='click.php?id=".$ban['ban_id']."' target=_blank>".
"<img src='".$ban['ban_img']."' width=468 height=60 border=0></a>";
}
mysql_query("UPDATE tabla SET ban_impre = ban_impre+1 WHERE ban_id = '$rand'");
?>