|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-01-23 09:02 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 07:00:01 2025 UTC |
When querying a sybase (11.9.2) table field which is defined as numeric(12,6), on the first fetch, the value is typed "float". On the next fetch and onwards, the value is typed "int", so the fractional part is lost. This behavior did not exist in PHP 4.1, where values were typed "string" when they were numeric. Example: (Run in isql) CREATE TABLE sometable ( val numeric(12,6) ) go INSERT INTO sometable VALUES (15.5) INSERT INTO sometable VALUES (14.4) INSERT INTO sometable VALUES (12.33) INSERT INTO sometable VALUES (17.18) go (PHP script) <?php header( 'Content-type: text/plain' ); $conn = sybase_connect( 'host', 'user', 'password' ); sybase_select_db( 'user', $conn ); $res = sybase_query( "SELECT val FROM sometable" ); while ( false !== ( $rec = sybase_fetch_row( $res ) ) ) { echo "val = $rec[0]\n"; } ?> (displayed result) val = 15.5 val = 14 val = 12 val = 17