Bug #17681: Datatype numeric query error
| From: | hillbun at hotmail dot com | Date: | Mon, 10 Jun 2002 13:34:31 +0000 |
| Subject: | Bug #17681: Datatype numeric query error | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-10018@lists.php.net to get a copy of this message | ||
From: hillbun@hotmail.com
Operating system: Redhat 7.2
PHP version: 4.2.1
PHP Bug Type: Sybase (dblib) related
Bug description: Datatype numeric query error
We create a table with a field in type of numeric(18,2)
In case of isql, I get the correct result, but in case of PHP, the result
is strange
create table test
(
Id varchar(32) not null,
AA numeric(18,2) not null,
constraint PK_ID primary key (Id)
)
go
INSERT INTO test (Id, AA) VALUES ('0001', 80)
INSERT INTO test (Id, AA) VALUES ('0002', 80.00)
INSERT INTO test (Id, AA) VALUES ('0003', 80.01)
INSERT INTO test (Id, AA) VALUES ('0004', 80.5)
INSERT INTO test (Id, AA) VALUES ('0005', 80.50)
INSERT INTO test (Id, AA) VALUES ('0006', 80.51)
INSERT INTO test (Id, AA) VALUES ('0007', 1111111111111111.55)
INSERT INTO test (Id, AA) VALUES ('0008', 1111111111111111.50)
go
My test script is:
<?php
@$results = sybase_query("select * from test");
while ($row = sybase_fetch_array($results)){
echo "$row[0] ||$row[1] <br>";
}
?>
But I get the following results:
0001 ||80.0
0002 ||80.0
0003 ||80.010000000000005
0004 ||80.5
0005 ||80.5
0006 ||80.510000000000005
0007 ||1111111111111111.5
0008 ||1111111111111111.5
--
Edit bug report at http://bugs.php.net/?id=17681&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=17681&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=17681&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=17681&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=17681&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=17681&r=support
Expected behavior: http://bugs.php.net/fix.php?id=17681&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=17681&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=17681&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=17681&r=globals