php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21047 Query to float fields don't return the decimal part
Submitted: 2002-12-16 11:05 UTC Modified: 2003-03-10 09:27 UTC
Votes:4
Avg. Score:5.0 ± 0.0
Reproduced:4 of 4 (100.0%)
Same Version:3 (75.0%)
Same OS:2 (50.0%)
From: alietss at yahoo dot com Assigned:
Status: Not a bug Package: Sybase-ct (ctlib) related
PHP Version: 4CVS-2002-12-16 (stable) OS: Linux RedHat8.0
Private report: No CVE-ID: None
 [2002-12-16 11:05 UTC] alietss at yahoo dot com
Hi PHP people, first as all thank's for a great software, well I'm testing the new php-4.3.0 in my Redhat 8.0 box, httpd-2.0.40-13, phpCVS-2002-12-16(stable), I built rpms of this versi?n using sybase-ct with freetds-0.60, I had in the past the same freetds but with php-4.2.4-dev and everyhing works ok, but now when I query float fields of a Microsoft sql server dont't return the decimal part of my float numbers and this is very important to me, I get just the integer part. Here it goes my configuration...

 './configure' '--host=i686-pc-linux-gnu' '--build=i686-pc-linux-gnu' '--target=i686-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--prefix=/usr' '--with-config-file-path=/etc' '--enable-force-cgi-redirect' '--disable-debug' '--enable-pic' '--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-db3' '--with-curl' '--with-dom=/usr' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd' '--enable-gd-native-ttf' '--with-ttf' '--with-gdbm' '--with-gettext' '--with-pdflib=shared' '--with-tiff-dir=/usr' '--with-ncurses' '--with-gmp' '--with-iconv' '--enable-xslt=shared' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-pspell' '--with-regex=system' '--with-xml' '--with-expat-dir=/usr' '--with-zlib' '--with-layout=GNU' '--enable-bcmath' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-discard-path' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--without-oci8' '--with-pear=/usr/share/pear' '--with-imap=shared' '--with-imap-ssl' '--with-kerberos=/usr/kerberos' '--with-ldap=shared' '--with-mcal=shared,/usr' '--with-mcrypt=shared,/usr' '--with-mhash=shared,/usr' '--with-mysql=shared,/usr' '--with-pgsql=shared' '--with-snmp=shared,/usr' '--with-snmp=shared' '--with-sybase-ct=shared,/usr' '--with-xslt-sablot=shared,/usr' '--with-sablot-js=shared,/usr' '--enable-ucd-snmp-hack' '--with-unixODBC=shared' '--enable-memory-limit' '--enable-bcmath' '--enable-shmop' '--enable-versioning' '--enable-calendar' '--enable-dbx' '--enable-dio' '--enable-mcal' '--with-apxs2=/usr/sbin/apxs'

Here the sript I use.. to query

$idres=mssql_query ("SELECT NUMDOC,FECHA,DESCCONCI,DESCRIPCION,DEBE,HABER,BRUTO,PAGO FROM submayor WHERE  CODAREA='$Area' and FECHA>=convert(DATETIME,'$fdesde',102) and FECHA<=convert(DATETIME,'$fhasta',102)   order by FECHA",$id);
       }
    $cant=mssql_num_rows ($idres);
    $TOTD=0;
	$TOTH=0;
	$TOTI=0;
	$TOTP=0;
    for ($i =1; $i <= $cant; $i++) {
           $row = mssql_fetch_array ($idres);
           $NUMDOC=$row["NUMDOC"];
           $FECHCOB=$row["FECHA"];
           $DESCCLI=$row["DESCCONCI"];
           $OBSERVAC=$row["DESCRIPCION"];
           $DEBE=$row["DEBE"];
	   $HABER=$row["HABER"];
	   $BRUTO=$row["BRUTO"];
	   $PAGO=$row["PAGO"];
     }//end for
DEBE HABER BRUTO PAGO are float fields 
                                          Bye Aliet

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-30 23:59 UTC] david at sportodds dot com
I've fixed this error by changing the source but how do I post the fix to the site for inclusion in a future build?

Please assist?

David Hargreave
IT Manager
SportOdds Systems Pty Limited
www.sportodds.com
 [2002-12-31 02:23 UTC] derick@php.net
Cool! The best way would be to supply a patch which you can make with:
diff -u original_file.c new_file.c > /tmp/file.c.patch
and send put it online somewhere.

Thanks!

Derick
 [2003-01-16 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over 2 weeks, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2003-03-10 02:44 UTC] mattiass at commentor dot se
Bug still exsists and has done so since php 4.2.3. Float numbers still only show decimals. The first query row parses correctly, but the rest of the rows foobars.
 [2003-03-10 03:52 UTC] mattiass at commentor dot se
Further information,

In php 4.2.2, all float numbers are returned as numeric, which is correct.

In php 4.3.1, the first row is returned as numeric and the following as integers..
 [2003-03-10 09:27 UTC] sniper@php.net
Add any comments to bug #22618 where we got some feedback.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 21:01:27 2024 UTC