[PHP] Re: MySQL and PHP math problem...

2002-11-09 Thread @ Edwin
Hello,

"Peter" [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

...[snip]...

 the result of echo, $tmp is displayed as '0.0002'.  What's wrong here?
The
 problem only occurs when the value is greater than a 1,000?  Could the ','
 messed the computation up somehow?

I think so because

  1/5000 = 0.0002

(Only the number *before* the ',' is being used.)

Try taking away the ',' then by using str_replace() and calculate again.

- E


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: MySQL and PHP math problem...

2002-11-09 Thread Peter
Thanks...the thing that I did wrong was I retrieved the number with
FORMAT(SUM(amount), 2), which formats the number and return it in the string
format...so that's what happened during the computation (it only took the
number prior to the ','.  I miss the type-checking in C. :-)

Thanks,
-Peter
@ Edwin [EMAIL PROTECTED] wrote in message
news:20021109134728.65621.qmail;pb1.pair.com...
 Hello,

 Peter [EMAIL PROTECTED] wrote in message
 news:20021109065959.35268.qmail;pb1.pair.com...

 ...[snip]...

  the result of echo, $tmp is displayed as '0.0002'.  What's wrong here?
 The
  problem only occurs when the value is greater than a 1,000?  Could the
','
  messed the computation up somehow?

 I think so because

   1/5000 = 0.0002

 (Only the number *before* the ',' is being used.)

 Try taking away the ',' then by using str_replace() and calculate again.

 - E




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php