|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21841 Numeric fields converted to int
Submitted: 2003-01-23 07:58 UTC Modified: 2003-01-23 09:02 UTC
From: herouth at itouch dot co dot il Assigned:
Status: Closed Package: Sybase-ct (ctlib) related
PHP Version: 4.3.0 OS: Linux
Private report: No CVE-ID: None
 [2003-01-23 07:58 UTC] herouth at itouch dot co dot il
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.

(Run in isql)

CREATE TABLE sometable ( val numeric(12,6) )
INSERT INTO sometable VALUES (15.5)
INSERT INTO sometable VALUES (14.4)
INSERT INTO sometable VALUES (12.33)
INSERT INTO sometable VALUES (17.18)

(PHP script)

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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-23 09:02 UTC]
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at
In case this was a documentation problem, the fix will show up soon at

In case this was a website problem, the change will show
up on the site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 15 06:01:31 2024 UTC