benhodgson Posted April 24, 2006 Share Posted April 24, 2006 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. Quote Link to comment Share on other sites More sharing options...
rab Posted April 24, 2006 Share Posted April 24, 2006 [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 anyif($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. Quote Link to comment Share on other sites More sharing options...
benhodgson Posted April 24, 2006 Author Share Posted April 24, 2006 Only needed the actual part to go in the IF section, but fantastic, have it working now. Thanks for your help :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.