if < than 40 then change color

Ask about a PHP problem here.
Post Reply
User avatar
leverkusen
Posts: 69
Joined: Sun Nov 18, 2012 10:09 pm
Location: Belgrade
Contact:

if < than 40 then change color

Post by leverkusen »

hey i have this [syntax=php]
echo '<td align="center"><font style=color:lightblue size="2"><b>'.intval(100*$row['win']/$row['played']).'%</b></font></td>';[/syntax]
this calculates % of won games
i want to make a color to red when % is lower than 40%, yellow when is 40-60% and green when is more than 60%
how can i do that? if result <40 then show this row in red color
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: if < than 40 then change color

Post by Temor »

Have you tried yourself? This really is the easiest thing one can do in programming. It's just simple IF statements.

IF <= 40 $color = red
IF > 40 && < 60 $color = yellow
IF > 60 $color = green
User avatar
leverkusen
Posts: 69
Joined: Sun Nov 18, 2012 10:09 pm
Location: Belgrade
Contact:

Re: if < than 40 then change color

Post by leverkusen »

Thanks, this worked, its solved! :D
Post Reply