Is this a good way? (Banner rotator)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
keith2045
Forum Newbie
Posts: 1
Joined: Sun Nov 17, 2002 1:09 pm
Location: Missouri, USA
Contact:

Is this a good way? (Banner rotator)

Post 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
User avatar
Johnm
Forum Contributor
Posts: 344
Joined: Mon May 13, 2002 12:05 pm
Location: Michigan, USA
Contact:

Post by Johnm »

Post Reply