Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- New to PHP. Need a little help.


tmrchris - 2:58 pm on Jun 28, 2012 (gmt 0)


I have a code which was written by a friend of mine for the radio station I work at. It displays the on air now info of the current show and additionally 'next' etc.

<?php
function getdetails(){
date_default_timezone_set ("GMT +5");


$d = date("D");
$t = date("H", time());
switch ($d)
{

/////////////////////////////////Monday////////////////////////
case Mon:

//////////////////////////up to 1am////////////
if ($t < 1) {

$title = "Late Night Love Songs";


$next = "Non Stop Pop at 1am";
$image = "<img src=\"images/love.png\"></img>";
$player = "<img src=\"images/nonstopcube.png\"></img>";
$onairnow = "The best chilled out songs ever made - back to back to end the day...";
}
////////////////////////////////////////////////

///////////////////////////////////////////////
elseif ($t < 12) {

$title = "Non Stop Pop";

$image = "<img src=\"images/nonstop.png\"></img>";
$player = "<img src=\"images/nonstopcube.png\"></img>";
$next = "Non Stop Pop";
$onairnow = "All your favourite pop tunes non-stop!";
}
////////////////////////////////////////////////

///////////////////////////////////////////////
elseif ($t < 19) {

$title = "Non Stop Pop";

$image = "<img src=\"images/nonstop.png\"></img>";
$player = "<img src=\"images/nonstopcube.png\"></img>";
$next = "Club Mix at 7pm";
$onairnow = "All your favourite pop tunes non-stop!";
}
////////////////////////////////////////////////

///////////////////////////////////////////////
elseif ($t < 22) {

$title = "Club Mix";

$image = "<img src=\"images/club.png\"></img>";
$next = "Late Night Love Songs at 10pm";
$onairnow = "The biggest dance floorfillers of all time";
}
////////////////////////////////////////////////


////////////10pm - 12am//////////////////////
else {

$title = "Late Night Love Songs";


$next = "Non Stop Pop at 1am";
$image = "<img src=\"images/love.png\"></img>";
$player = "<img src=\"images/nonstopcube.png\"></img>";
$onairnow = "The best chilled out songs ever made - back to back to end the day...";
}
////////////////////////////////////////////
break;


I now want the code to show up at xx:45 instead of xx:00. Looking at PHP: date [php.net] it says i=minutes. I've tried changing the code to H:i and then creating $t < 22 $i < 45 for example but that doesn't work.

How do I go about doing this? Many thanks for any help given. I'm trying to learn this by the way and have been doing my own research hence how I got here.


Thread source:: http://www.webmasterworld.com/php/4470468.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com