> Hi, I'm using a mysql connection to dinamically fill a table with
> descriptions, prices, and so on...
> 
> But when the script takes the price of a Plasma Monitor, that costs
> 8025.00
> $, it outputs only 8,00.
> I recall it by typing :
> 
> echo $row_Recordset1['Prezzo']
> 
> And please note that I've seen that it happens only when
> $row_Recordset1['Prezzo'] > 1000

Check what the type is on your column. Since you show it has a comma in
it, I'll assume it's a varchar. Since you can't store a number over
1000, I'll also guess that it's a varchar(3) column. 

If you're typing in 8025.00 and it's getting stored as 8,00 then how are
you processing it before storing it? Something has to add in the comma,
right?

Prices should be stored as a DECIMAL column type. You should validate
what the user puts in and _make_ it into a decimal. Can you always
assume that a period is the decimal separator? Some countries use a
comma for a decimal separator and the period as the thousands separator.
You must validate everything from the user and format it to match what
you need and reject everything else. Plain and simple. :)

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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

Reply via email to