php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17681 Datatype numeric query error
Submitted: 2002-06-10 09:34 UTC Modified: 2002-06-10 09:37 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: hillbun at hotmail dot com Assigned:
Status: Not a bug Package: Sybase (dblib) related
PHP Version: 4.2.1 OS: Redhat 7.2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: hillbun at hotmail dot com
New email:
PHP Version: OS:

 

 [2002-06-10 09:34 UTC] hillbun at hotmail dot com
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 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-10 09:37 UTC] mfischer@php.net
Sorry, but the bug system is not the appropriate forum for asking
support questions. Your problem does not imply a bug in PHP itself.
For a list of more appropriate places to ask for help using PHP,
please visit http://www.php.net/support.php

Thank you for your interest in PHP.

See the manual section about floats.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 22:01:26 2024 UTC