troubleshooting Question

php and colouring cells

Avatar of doctorbill
doctorbillFlag for United Kingdom of Great Britain and Northern Ireland asked on
3 Comments1 Solution107 ViewsLast Modified:
 <?php while ($row = $results->fetch_assoc()):$style = "";
  //if ($row['frm_id'] < "5"){
    //$style2 = "style='background:#FF0000;'";
  //if ($row['frm_id'] > "5"){
    //$style2 = "style='background:#FFF000;'";
         //if ($row['frm_id'] =="5"){
    //$style2 = "style='background:#ddd000;'";
       $data_new = $row['radnew'];
       $data_progress = $row['radinprogress'];
        $data_closed = $row['radclosed'];
if (isset ($row['radnew'])) {
    $style2 = "style='background:#ddd000;'";
      else if (isset ($row['radinprogress'])){
    $style3 = "style='background:#FFa500;'";
         else if (isset ($row['radclosed'])){
    $style4 = "style='background:rgb(255,100,0);'";

                <table id="customers">
                  <th>Ticket Status:</th>
                     <th>Ticket Status:</th>
                     <th>Ticket Status:</th>
                        <td><?= $row['sup_id'] ?>&nbsp;<?php echo "<a href=\"searchWorkformSitesDateStatus.php?id=" . $row['sup_id'] ."\" target=\"_blank\">RecordLink... </a>"; ?></td>
                        <td><?= $row['sup_company'] ?></td>
                        <td><?= $row['sup_contact'] ?></td>
                        <td <?php echo $style2 ?>><?= $row['radnew'] ?></td>
                        <td <?php echo $style3 ?>><?= $row['radinprogress'] ?></td>
                        <td <?php echo $style4 ?>><?= $row['radclosed'] ?></td>
            <?php endwhile; ?>

In the above code I am trying to colour individual cells if they have a value set
Whai is happening at the moment is that cells are coloured but empty cells as well as cells with values set (seel attached file)
I am also getting an undefined variable error
Where am I going wrong with this please

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros