I have written the following PHP, to basically show a LI if the status is set to Offline or Delay:
<?php
if(count($rows) > 0) {
foreach($rows as $row)
{
$service = $row->service;
$details = $row->status_details;
$status = $row->status;
// status image check
if($status == "ONLINE")
{
$symbol = "online.png";
}
if($status == "OFFLINE")
{
$symbol = "offline.png";
}
if($status == "DELAY")
{
$symbol = "delay.png";
}
?>
<li class="<?php echo $status; ?>">
<img src="<?php echo $moduleLoc, $symbol;?>" alt="Service Status <?php echo $service; ?>" /> <span class="details"><?php echo $details; ?></span></li>
</li>
<?php
}
?>
<?php } ?>
Using CSS, if the class of "ONLINE" is then shown, then LI is hidden.
However, I want to add a statement to be shown if the status is OFFLINE or DELAY, I've written the following, which is working but due to the foreach statement, it's showing for every LI that has either OFFLINE or DELAY. I want it to be shown only once:
<?php
if(($status == "OFFLINE") || ($status == "DELAY")){
echo '<li class="systemsGo"><img src="' . $moduleLoc . 'online.png" alt="Online Update" /><span class="details">All Other Applications Are Working Well</span></li>';
}
?>
foreach
loop areOFFLINE
orDELAY
? Or do you only want to display it if, for example, the status of the first result status isOFFLINE
orDELAY
?