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 5 of 5
  1. #1
    New Coder
    Join Date
    Mar 2007
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    a comma into an int

    hey

    i got a problem

    i got a field in my database
    aantal decimal(5,2)

    when i try to full it it doesn't works (correctly)
    when i put 15.21 into it it works great
    but when i put 15,21 into it the field will be 15

    i think that is because he dont get the comma.. is that correct? and does anyobdy has a solution

    dont come up with u need to write a . :P

    this info i got from phpinfo(); .. i u want more info just ask i will try my best then

    mysql
    MySQL Support enabled
    Active Persistent Links 0
    Active Links 0
    Client API version 3.23.49
    MYSQL_MODULE_TYPE builtin
    MYSQL_SOCKET /tmp/mysql.sock
    MYSQL_INCLUDE no value
    MYSQL_LIBS no value

  • #2
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,633
    Thanks
    4
    Thanked 148 Times in 139 Posts
    store it as a decimal and then use REPLACE when you pull your data out and display it.

    similarly store it as a decimal and then use PHP or whatever to do the substitution.

    On a different note, your version of mysql is severely out of date, you should look into upgrading it.

  • #3
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,610
    Thanks
    0
    Thanked 645 Times in 635 Posts
    All computer programs use . as the decimal point and not , so you need to convert the , to a . before you can treat the field as a number.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #4
    New Coder
    Join Date
    Mar 2007
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by guelphdad View Post
    On a different note, your version of mysql is severely out of date, you should look into upgrading it.
    jep but unfortinualy it is mine server of the work.. where i dont got the manage of it


    i will use the . in the future in stead of the , or i will build some script for it

    thnx for the info

  • #5
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,633
    Thanks
    4
    Thanked 148 Times in 139 Posts
    Quote Originally Posted by traxion View Post
    jep but unfortinualy it is mine server of the work.. where i dont got the manage of it
    Workplaces do stupid things don't they? 3.23.49 was released in February 2002. They are three major releases behind!


  •  

    Posting Permissions

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