Jump to content

IF help


benhodgson

Recommended Posts

I'm currently writing a schedule system for a radio station.

Basically the schedule page will look a little like this [a href=\"http://www.zodiacwebdesign.co.uk/sites/demonfm/\" target=\"_blank\"]http://www.zodiacwebdesign.co.uk/sites/demonfm/[/a]

Now what I want to do is have the system check the current time using $nowtime = date("Hi"); and $nowday = date("D"); and compare it with the entries in the database $day, $starttime and $endtime. If a show is today and nowtime is between $starttime and $endtime, meaning the show is on air at the moment, then I want the show to appear in a different font colour.

As you can see from the site I'm having some difficulty and my code is now a little messed up. Is there anyone out there who can give me a hand and make this work?

[code]if (what goes here?)
{
echo "<span class=\"main\"><strong>$start - $end</strong> $name</span><br />";}
else
{
echo "<span class=\"nowshow\"><strong>$start - $end</strong> $name</span><br />"
;}[/code]

Many thanks in advance.
Link to comment
Share on other sites

[code]
$nowtime = date("Hi"); //Getting time
$nowday = date("D"); //Getting day

$query = mysql_query("SELECT * FROM show WHERE day like '$nowday'") or die(mysql_error());//Getting all data from the table where the show is to day
$query_rows = mysql_num_rows($query); //Seeing if there is any

if($query_rows > 0)//if more than 0 then there is atleast 1 show today
{
     while($shows = mysql_fetch_array($query)) // putting into an array
      {
          $start = $shows['start'];
          $end = $shows['end'];
      }
      
     if(($nowtime =< $end) && ($nowtime >= $start)) //checking if the time is inbetween show times
     {
             echo "<font color=#FF0000>Show</font>";
     } else echo "<font color=#000000>Show</font>";
}echo "<font color=#000000>Show</font>";
[/code]

Something I threw together, I hope thats what you want.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.