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

12-26-2010, 09: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

12-27-2010, 12:12 AM
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?

12-28-2010, 11: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.