[PHP] Number formatting

2002-06-06 Thread Scott
Hi gang- I am trying to format a number coming from a csv file that I am importing then sending to a database. Being the wonderful program that Excel is there is a column that contains a number that only has a decmimal if there is a value. So 3.05% will display, 3% will display as 3. It is

Re: [PHP] Number formatting

2002-06-06 Thread Shane Wright
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi $aprTemp = number_format($apr, 2); which in the case of 3.05 will return 305.00 and 300.00 for 3%. Anyone have a snippet to test and display properly so that 3% would be 3.00, etc. you could try this... $val = sprintf(%0.02f, $val); Cheers

Re: [PHP] Number formatting

2002-06-06 Thread Scott
Shane- Thank you for the response. This works, I also changed the column type to numeric with a scale of 2 in SQL Server. Thank you again. -Scott On Thu, 6 Jun 2002, Shane Wright wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi $aprTemp = number_format($apr, 2); which