Skip to Content.
Sympa Menu

freetds - [freetds] Strange issue with PHP

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "John" <johnh AT peruda.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: [freetds] Strange issue with PHP
  • Date: Mon, 17 Mar 2003 23:04:45 -0800

Hey all,

I have a question for any of you PHP people to mull over if you have a
minute. Server specs are as follows:

- Intel hardware / Linux Kernel 2.4.18-24.7.x
- PHP 4.3.1
- FreeTDS 0.61
- Apache 1.3.27

The problem is demonstrated in this very basic script:

$query1 = "select * from ext_item_view where category_4='210' ORDER BY
item_number";
$result = mssql_query($query1) or die("Error in query");

while ($recs = mssql_fetch_array ($result))
{
$item = $recs["item_number"];
$products[$item]["item"]=$recs["item_number"];
$products[$item]["price"]=$recs["price"];
echo $products[$item]["item"] . " = " . $products[$item]["price"] .
"<br>";
}

You can view the output from that script on the box described above here:
http://www.peruda.com/superpr/test2.php and you can contrast that with the
results from the *same* script running on a Sparc/SunOS box with PHP 4.0.6
and Apache 1.3.20 here: http://www.superproducts.com/test2.php

As you can see, the issue is that the numbers being retrieved from the
database are truncated to the decimal point (all except the number in the
first row of the array, which is truncated to digits to the right of the
decimal point.) At the second URL above
(http://www.superproducts.com/test2.php) the numbers are not truncated -
they extend to four digits beyond the decimal point, and this is the way it
*should* look.

Any thoughts or suggestions on this would be greatly appreciated! Thanks so
much!!

-John H.




Archive powered by MHonArc 2.6.24.

Top of Page