Switch not going to last case |
On my page I can see who's online and away. How every it does not switch to offline.
Does not go to the last switch case seems to stop at away How can I make sure switches offline correct. I have set it up in short time intervals for testing PHP Code: $questions_userinfo = $this->question_model->get_user($question_info['question_user_id']);
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
You are using a wrong logic here
$whosonlinetime > $questions_userinfo['online'] + 400: $whosonlinetime > $questions_userinfo['online'] + 600: if the value is 401 or GREATER the away condition is true 601 is also greater then 400 so the 400 condition is still true your need something like this $whosonlinetime > $questions_userinfo['online'] + 400 && $whosonlinetime < $questions_userinfo['online'] + 600: or check for the +600 value first and then the +400
On the package it said needs Windows 7 or better. So I installed Linux.
You could also just remove the break right after:
$online = '<span class="text-warning">[AWAY]</span>'; Also, please make use of indenting your code. It's hard to read now, and it'll be hard to read later. PHP Code: switch($x)
PHP Code: $diff = time() - $questions_userinfo['online'];
(07-07-2017, 10:19 AM)Paradinight Wrote: Thank you. And thanks to all others who helped. This worked fine.
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
|
Welcome Guest, Not a member yet? Register Sign In |