#22341 [Opn]: Strange Rounding Problem with Money Fields

From: Date: Thu, 20 Feb 2003 23:40:07 +0000
Subject: #22341 [Opn]: Strange Rounding Problem with Money Fields
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-33763@lists.php.net to get a copy of this message
ID: 22341 User updated by: ryanphpb at ryanjameson dot com Reported By: ryanphpb at ryanjameson dot com Status: Open Bug Type: Sybase-ct (ctlib) related Operating System: windows 2000 PHP Version: 4.3.1 New Comment: NO!!!! Sorry about that the sample I gave you is not accurate. It turns out that the decimal values are only available for the first row in the record set. All consecutive rows after simply have the decimal chopped off. Here's a sample: while ($ar=sybase_fetch_array($rs)){ echo $ar['purchaseprice']."<br>"; } returns: 24.72 0 3 0 0 0 17 19 0 64 0 52 0 24 0 0 0 0 0 24 while the actual values are: 24.72 0.00 3.51 0.00 0.00 0.00 17.65 19.10 0.00 64.56 0.00 52.80 0.00 24.72 0.00 0.00 0.00 0.00 0.00 24.72 Previous Comments: ------------------------------------------------------------------------ [2003-02-20 17:26:00] ryanphpb at ryanjameson dot com There's an old report #13807 that sounds similar to what I'm experiencing. The issue is that a value of 11.16 is coming back in my result array as 11. Other values in the same field in the same result are coming back fine, ie... the previous value was 111.6. So for some reason this field is rounding wrong but just for this value. When I look at it through ODBC with MS Access I see 11.16. -------------------------------- $q = "select producthandle.sellingprice from customerorder, producthandle where producthandle.id = customerorder.nr and customerorder.nr = '030216-22782' and class='CO'"; $con = sybase_connect("#server#","#user#","#password#"); $rs = sybase_query($q,$con); while ($ar=sybase_fetch_array($rs)){ echo $ar['sellingprice'] . "<br>"; } ------------------------ OUTPUT: 111.6 11 33.4 555.3 12.31 1.23 ------------------------ The 11 should be 11.16... The field type is native sybase money. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=22341&edit=1

« previous php.bugs (#33763) next »