I am trying to color each row separately depending on the value of fact for each one of them. Instead, all I manage to do is to turn the whole table grey. I guess that the last value if fact is 'N' and so the last if is in effect. How do I cope with this? Below is my code.
<?php
while($row= mysqli_fetch_array($query))
{
if($row['fact']='E')
echo '<tr style="background-color:green">';
if($row['fact']='R')
echo '<tr style="background-color:red">';
if($row['fact']='N')
echo '<tr style="background-color:grey">';
echo '<td>'.$row['id'].'</td>';
echo '<td>'.$row['nume_port'].'</td>';
echo '<td>'.$row['adr'].'</td>';
echo '<td>'.$row['fact'].'</td>';
echo '<td>'.$row['owner'].'</td>';
echo '<td>'.$row['nivel'].'</td>';
echo '<td>'.$row['chei'].'</td>';
echo '<td>'.$row['rezon'].'</td>';
echo '<td>'.$row['dist'].'</td>';
echo '<td>'.$row['ult_inc'].'</td>';
echo'</tr>';
}?>
Edit: this question is not a duplicate, since I've not suspected that the equals are the problem. I thought there's a problem with the method I used.