I'm attempting to trigger things based on time.
I have one shop that has opening hours, closing hours and lunch hours store
as full hour values, integer, in MySQL.
I retrieve them, based on comparisons either shop is open, about to close or
actually closed.
When open, nothing particular is written, when closed, customer is informed
orders can't be executed, shop is closed.
But the last one, right about 15 minutes before closing time, should trigger
a special message to customers, but that comparison just won't work.
[code]
This is what I got:
$closeManTor = (int) $row["closeManTo r"];
$timer = (int) date("H");
$minutter = (int) date("i");
and in a switch statement:
if(($closeManTo r-1) == $timer && $minutter >= 45)
return $almost_closed;
[code]
I tried to modify the last comparing statement to a simpler way,
if($closeManTor == $timer && $minutter >= 0)
return $almost_closed;
but even this fails.
I know for sure that I do compare integers, all have been checked using
gettype(), but that simple if statement just won't trigger anything.
Yes, I have assigned a value to $almost_closed, no problem there.
The switch works fine, as I have another if sentence in the same triggered
statement that works just fine. Connecting these two if-statements with an
if-else-if structure, didn't change anything at all, that's why the first
statement isn't shown here.
I really am getting grey hair here, rather, more then I do have ... and I'm
too young to get all grey haired already now ;-)
I'm sorry, but I really don't understand this one here.
/Andreas
--
Registeret Linux user #292411
Comment