PHP if statement does not work
<p>I have written a code where a value is got from mysql and if it is 1 then row should be in red colour and if it is 0 the row should be in green colour. When I execute the code it always goes to the else statement.</p>

<p>Code is as below:</p>

<pre><code>while ($row = mysqli_fetch_array($result))
{
    $bprofit=$row['profit_loss'];
    if ($bprofit == "1") {
        $colour='#FF0000';
    } else  {
        $colour='#31B404';
    }
    echo "&lt;tr bgcolor=$colour&gt;";
    echo "&lt;td&gt;" . $bprofit . "&lt;/td&gt;";
}
</code></pre>

<p>and output is:</p>

<p>1<br>
0
0
all in green colour only.</p>

<p>Any suggestions?</p>
