Jump to content

More mysql stuff


Recommended Posts

I am using the MYSQL udf from http://www.autoitscript.com/forum/index.php?showtopic=20814 . I have a table called users that is described as (username varchar(40), credit float(5,3)). When I am at the command prompt and I select * from users, I can see that my test user, mtie_dye, has a credit of 23.456. However, when I use the MYSQL udf to extract and display that information, it displays 23.45599993743896.

Dim $user[2]
       $user[0] = "mrtie_dye"
       $user[1] = 0
       $connect = _MySQLConnect($sqlUserName, $sqlPassword, "auratus", "localhost");connect to mysql
       If $connect == 0 Then;if we can't connect, bail out. 
           MsgBox(0,"","Unable to connect to database.")
           Exit
       EndIf
       
       $query = _Query($connect,"SELECT * FROM users WHERE username = '" & $user[0] & "'");find the user
       With $query;put the user into the user array
           While NOT .EOF
               $user[1] = .Fields("credit").value
               .MoveNext
           WEnd
       EndWith
       MsgBox(0,"credit",$user[1]);should be 23.456, but is 23.45599993743896

Why is it doing this, or what would be the best way to chop off some of those numbers?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...