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 4 of 4

Thread: Decimal

  1. #1
    Senior Coder
    Join Date
    Apr 2010
    Posts
    1,446
    Thanks
    71
    Thanked 102 Times in 101 Posts

    Decimal

    I am using Decimal type under the column "Strength". Currently it's whole numbers such as 25, 40, 100. I'd like it to be a maximum of 5 whole numbers followed by 3 decimal numbers, such as 80.400 or 143.009

    In the database I did 5,3 as the length/value but it doesn't work.

    Also how do you update the value in the database? Does it need to be
    Code:
    decimal(1,002);
    or something else?

    Thanks,
    Been a sign maker for 7 years. My business:
    American Made Signs

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    5,3 is too small. You need to have 8,3 to have 5 whole numbers and 3 decimal numbers.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #3
    Senior Coder
    Join Date
    Apr 2010
    Posts
    1,446
    Thanks
    71
    Thanked 102 Times in 101 Posts
    Thanks and whats the best insert method? Like if I want to add 1.005 or 0.030
    Been a sign maker for 7 years. My business:
    American Made Signs

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    The documentation implies that it stuffs bits into bytes, so that would say that you would treat it as a number. Insert it the same way you'd insert a float.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Posting Permissions

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