Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Dec 2010
    Posts
    19
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Dividing negative,0,positive value of a field by 5?

    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

  • #2
    New Coder
    Join Date
    Sep 2009
    Location
    /bin
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well, in case you're talking about the SQL query, it's as simple as:

    Code:
    SELECT (amount / 5) AS "custom_field_label" FROM table
    even adding the " AS "custom_field_label" " is optional, I mean you could simply write:

    Code:
    SELECT (amount / 5) FROM table
    Any further questions?

  • #3
    New Coder
    Join Date
    Dec 2010
    Posts
    19
    Thanks
    3
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •