En vez de elegir un ID random con PHP se puede hacer directo con MySQL
Código PHP:
$sql="SELECT id AS ID, titulo AS DESCRIPTION, url_banner AS URL_BANNER, mostrado AS IMPRESSIONS, numbermax AS LIMIT_ALLOW, username AS USERNAME FROM banner_rotating ORDER BY rand() LIMIT 0,1 ";
$result = mysql_query($sql, $con);
if ($row= mysql_fetch_array($result)) {
//list($v_id,$v_descriptionbanner,$vurl_site,$v_url_banner,$vmostrado,$vclick,$vlimit,$vusername)=mysql_fetch_array($registro);
$lim=$row["numbermax"];
if ($lim="") {
$vid=$row["ID"];
$desc=$row["DESCRIPTION"];
$ban=$row["URL_BANNER"];
$show=$row["IMPRESSIONS"];
$banner .= $desc ;
$vmostrado = $show + 1;
$actual = "UPDATE banner_rotating SET mostrado = '$vmostrado' WHERE id = '$vid'";
$registro = mysql_query($actual,$con);
print $ban;
}
}
$lim=$row["numbermax"];
if ($lim<$row["IMPRESSIONS"]) {
$vid=$row["ID"];
$desc=$row["DESCRIPTION"];
$ban=$row["URL_BANNER"];
$show=$row["IMPRESSIONS"];
$banner .= $desc ;
$vmostrado = $show + 1;
$actual = "UPDATE banner_rotating SET mostrado = '$vmostrado' WHERE id = '$vid'";
$registro = mysql_query($actual,$con);
print $ban;
}
?>