Page 1 of 1

Problem with $time variable

Posted: Mon Aug 25, 2003 9:24 am
by polosport6699
I don’t understand it but before a certain time in the morning the listen live box and now on air script do not function

I wrote a test script and tried it on my personal server

http://www.amishmastercrafts.net/am1.php

It successfully echoed the $time variable because the server time is 7:15 so it selected from 7:00
When I use that same script on our webserver

http://ubb.avemariaradio.net/amrwdeonet ... ve/am1.php

It does not echo anything…….This problem is very confusing to me because after some time during the day it just begins to work…

Code: Select all

$date = date("g:i:sa",strtotime("now"));

if(($date >= "6:59:02am" && $date <= "7:29:01am" )){ $time="7:00am"; }
elseif (($date >= "9:59:02am" && $date <= "10:29:01am" )){ $time="10:00am"; }
echo "$date";
echo "<br>";
echo "Working.....";
echo $time;
That’s my code I’m using to test if the selection is working…..

Posted: Mon Aug 25, 2003 4:46 pm
by mcsleazycrisps
surely using less than / greater than on a string won't work

the "am" and ":" would mean that $date is a string, and checking if a string is greater than something won't work. try formatting the date without the : and the AM, and PM to keep it as a number

Code: Select all

<?php
$date = date("Gis",strtotime("now"));

if (($date >= "65902" && $date <= "72901")){$time="7:00am";}
..
..