The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need a point in the right direction
#17
Well I'm making a bunch of progress, and am working on the logic now for it (to avoid clicking the same function more than once) and I am comfortable on figure that out tomorrow...but my OCD is getting to me again on another piece.

So I'm just trying to set a condition that changes some verbiage depending on how many results are returned. I have it half ass working, just not fully...

As of right now, if it finds no results, I get - "There is 0 person on break right now." <----- This bothers me. I just want it to say "There is no one on break right now."
If there's one person on break, I get - "There is 1 person on break right now.
Shawn"
If there's more than one person on break, I get - "There are 2 people on break right now.
Shawn
test"

I know I'm derping this up somewhere simple, but every form of >,<,<=,=>,== I try with any number just keeps failing. It'll fix one os the issues, then break another lol.

$breaksQ = $db->query("SELECT * FROM users WHERE on_break = 1");
$breaks = $breaksQ->results();
$countbreaks = $breaksQ->count();
if ($countbreaks <= 1) {
?>
<h3>There is <?=$countbreaks?> person on break right now.</h3>
<? foreach ($breaks as $b){
echo $b->fname;
echo "<br>";
}
}
elseif ($countbreaks >= 2) {
?>
<h3>There are <?=$countbreaks?> people on break right now.</h3>
<? foreach ($breaks as $b) {
echo $b->fname;
echo "<br>";
}
}
else {
echo "<h3>There is no one on break right now.</h3>";
  Reply


Messages In This Thread
Need a point in the right direction - by sandrews - 11-18-2016, 06:02 PM
Need a point in the right direction - by dan - 11-18-2016, 06:33 PM
Need a point in the right direction - by sandrews - 11-18-2016, 06:44 PM
Need a point in the right direction - by dan - 11-18-2016, 06:47 PM
Need a point in the right direction - by sandrews - 11-19-2016, 04:04 AM
Need a point in the right direction - by Brandin - 11-19-2016, 02:19 PM
Need a point in the right direction - by dan - 11-19-2016, 05:14 PM
Need a point in the right direction - by sandrews - 11-19-2016, 10:25 PM
Need a point in the right direction - by sandrews - 11-20-2016, 12:23 AM
Need a point in the right direction - by sandrews - 11-20-2016, 02:40 AM
Need a point in the right direction - by mudmin - 11-20-2016, 05:57 PM
Need a point in the right direction - by mudmin - 11-20-2016, 06:04 PM
Need a point in the right direction - by sandrews - 11-21-2016, 05:39 PM
Need a point in the right direction - by mudmin - 11-21-2016, 07:42 PM
Need a point in the right direction - by sandrews - 11-22-2016, 12:58 AM
Need a point in the right direction - by mudmin - 11-22-2016, 01:00 AM
Need a point in the right direction - by sandrews - 11-22-2016, 03:43 AM
Need a point in the right direction - by mudmin - 11-22-2016, 07:42 AM
Need a point in the right direction - by sandrews - 11-23-2016, 06:47 PM
Need a point in the right direction - by sandrews - 11-24-2016, 12:43 AM
Need a point in the right direction - by mudmin - 11-24-2016, 03:55 PM
Need a point in the right direction - by sandrews - 11-24-2016, 04:10 PM
Need a point in the right direction - by mudmin - 11-24-2016, 04:19 PM
Need a point in the right direction - by sandrews - 11-24-2016, 09:41 PM

Forum Jump:


Users browsing this thread: 9 Guest(s)