PHP if statement does not work -
i have written code value got mysql , if 1 row should in reddish colour , if 0 row should in greenish colour. when execute code goes else statement.
code below:
while ($row = mysqli_fetch_array($result)) { $bprofit=$row['profit_loss']; if ($bprofit == "1") { $colour='#ff0000'; } else { $colour='#31b404'; } echo "<tr bgcolor=$colour>"; echo "<td>" . $bprofit . "</td>"; }
and output is:
1 0 0 in greenish colour only.
any suggestions?
you have p in $bpprofit:
if ($bprofit == "1")
php
No comments:
Post a Comment