Page 1 of 1

Is this a good way? (Banner rotator)

Posted: Sun Nov 17, 2002 1:09 pm
by keith2045
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?

Code: Select all

<?php
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

Posted: Mon Nov 18, 2002 5:54 am
by Johnm