Change cell color based on MYSQL value
<p>I want to change td color using if statement but somehow my code is not affecting all rows</p>

<ol>
<li><p>this is my code : </p>

<pre><code>require_once("../model/materiel.class.php" . "");
$mt=new materiel();
$data=$mt-&gt;afficher_tous1();

echo '&lt;table id="customers2" class="table datatable table-striped"&gt;';
echo "&lt;thead&gt;
   &lt;tr&gt;
    &lt;th&gt;Qte disponible&lt;/th&gt;
    &lt;th&gt;Alert&lt;/th&gt;
   &lt;/tr&gt;
&lt;/thead&gt;";

echo "&lt;tbody&gt;";
  foreach($data as $t){

   echo "&lt;tr&gt;";
     if ($t['qte_disponible_m'] == 0){
     echo "&lt;td bgcolor='red'&gt;".$t['qte_disponible_m']."&lt;/td&gt;";
     }else if ($t['qte_disponible_m'] &gt; $t['alert_m']){
      echo "&lt;td bgcolor='green'&gt;".$t['qte_disponible_m']."&lt;/td&gt;";
       }else if ($t['qte_disponible_m'] == $t['alert_m']){
      echo "&lt;td bgcolor='yellow'&gt;".$t['qte_disponible_m']."&lt;/td&gt;";
     }

    echo "&lt;td&gt;".$t['alert_m']."&lt;/td&gt;";

echo "&lt;/tr&gt;";
}
echo "&lt;/tbody&gt;";
echo"&lt;/table&gt;";
</code></pre>

<ol start="2">
<li>the problem i have see the screenshot below :</li>
</ol>

<p>If statement is like jumping next row</p></li>
</ol>

<p><a href="https://i.stack.imgur.com/PxRuq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PxRuq.png" alt="Screenshot"></a></p>