keith2045
11-13-2002, 10:24 PM
Is this a good way to make a banner rotating program? What i have listed it just the main part where it picks the banner. It picks it by the weight and see's if it has started. I will make it to test to see if it has ended, but is this a good way? It doesnt seem very random, how can i make it more random?
while ($status == "bad")
{
$count++;
$data_seek = mysql_data_seek($count,$db_query);
$db_values = mysql_fetch_array($db_query);
if ($total_imp == 0)
{
$status = "good";
}
else
{
if ($db_values["start"] != "0000-00-00" and $db_values["end"] != "0000-00-00")
{
if (date("Y-n-j",strtotime($db_values["start"])) <= $date)
{
if (($db_values["imp"]/$total_imp) <= ($db_values["weight"]/$total_weight))
{
$status = "good";
$id = $db_values["id"];
}
}
}
else
{
if ($db_values["imp"]/$total_imp <= $db_values["weight"]/$total_weight)
{
$status = "good";
}
}
}
}
Keith
while ($status == "bad")
{
$count++;
$data_seek = mysql_data_seek($count,$db_query);
$db_values = mysql_fetch_array($db_query);
if ($total_imp == 0)
{
$status = "good";
}
else
{
if ($db_values["start"] != "0000-00-00" and $db_values["end"] != "0000-00-00")
{
if (date("Y-n-j",strtotime($db_values["start"])) <= $date)
{
if (($db_values["imp"]/$total_imp) <= ($db_values["weight"]/$total_weight))
{
$status = "good";
$id = $db_values["id"];
}
}
}
else
{
if ($db_values["imp"]/$total_imp <= $db_values["weight"]/$total_weight)
{
$status = "good";
}
}
}
}
Keith
