Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Is there a way to compare numbers like if 0.85 > 0.65 then

Quote Reply
Is there a way to compare numbers like if 0.85 > 0.65 then
I'm wondering if there is a simple built in way to compare numbers that appear in columns in the database.

For example, I've got two fields, one is user inputed as #.## (where # is obviously a number), then I've got another field from a second table that is also #.## (not user inputed).

When it comes to the detailed.html template I'd like to compare these two numbers and if the user inputed number is lower then print it out in green, if it's higher than the second number then print it out in red.

Something like this maybe:
Code:

<%if card1price > get_value_prices($cardname1)%><font color="red"><%card1price%></font><%else%><font color="green"><%card1price%></font><%endif%>


I'm not sure what actually goes in the place of the ">" between card1price and get_value_prices to try to figure out if the first value is greater than the second value, or if it's even possible.

Any questions please ask.

Thanks you know who for all the help. Wink

Last edited by:

Westin: May 8, 2009, 8:36 PM
Subject Author Views Date
Thread Is there a way to compare numbers like if 0.85 > 0.65 then Westin 5465 May 8, 2009, 8:35 PM
Thread Re: [Westin] Is there a way to compare numbers like if 0.85 > 0.65 then
Andy 5333 May 9, 2009, 1:47 AM
Thread Re: [Andy] Is there a way to compare numbers like if 0.85 > 0.65 then
Westin 5315 May 9, 2009, 4:56 AM
Thread Re: [Westin] Is there a way to compare numbers like if 0.85 > 0.65 then
Westin 5323 May 9, 2009, 5:02 AM
Thread Re: [Westin] Is there a way to compare numbers like if 0.85 > 0.65 then
Westin 5348 May 9, 2009, 5:23 AM
Post Re: [Westin] Is there a way to compare numbers like if 0.85 > 0.65 then
Andy 5294 May 9, 2009, 6:38 AM
Post Re: [Westin] Is there a way to compare numbers like if 0.85 > 0.65 then
Wychwood 5265 May 10, 2009, 3:30 AM