stat comparison
Posted: Wed Jul 06, 2005 1:27 pm
hello im working on a script to compair user statistics. I have 20 different stats stored in a database. what i have done so far is take the stats and find the difference.
something like that but a little more complex.
the first thing i want done is if stat1-stat2=0 i want it to display 0 in blue text, if stat1-stat2=any posative number i want it to display the number in green text and if stat1-stat2=any negative number i want it to be displayed in red text. I know im going to use an If statement, but i dont know how to make the if statement determine whether the value is posative, negative or 0.
Once that is done i want the script to take the absolute value of $stat and display it as a posative number. The user will know his number is negative, equal or posative by the color or the text. So i was wondering if someone could give me a few functions i could look at that might help me out. Ill give them a try and when i have troubell with those ill let you know.
Any help is appreciated.
Thanks.
Code: Select all
$stat=stat1-stat2;
echo $stat;the first thing i want done is if stat1-stat2=0 i want it to display 0 in blue text, if stat1-stat2=any posative number i want it to display the number in green text and if stat1-stat2=any negative number i want it to be displayed in red text. I know im going to use an If statement, but i dont know how to make the if statement determine whether the value is posative, negative or 0.
Once that is done i want the script to take the absolute value of $stat and display it as a posative number. The user will know his number is negative, equal or posative by the color or the text. So i was wondering if someone could give me a few functions i could look at that might help me out. Ill give them a try and when i have troubell with those ill let you know.
Any help is appreciated.
Thanks.