...

View Full Version : Dividing negative,0,positive value of a field by 5?



don1081
12-26-2010, 08:34 PM
How to divide each value of field "amount" by 5 and display in php page?
The value of ''amount'' are negative, zero and positive.
From table "profit" where id=user_id

ActiveX
12-26-2010, 11:12 PM
Well, in case you're talking about the SQL query, it's as simple as:


SELECT (amount / 5) AS "custom_field_label" FROM table

even adding the " AS "custom_field_label" " is optional, I mean you could simply write:


SELECT (amount / 5) FROM table

Any further questions?

don1081
12-28-2010, 10:03 AM
thanks, it worked but it is showing only round figures. How to show actual value?
for examle, if 57/5 = 11.4 but it is displaying 11.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum