Mar 26, 2004 #1 tristero Programmer Jan 24, 2003 95 US i have a table with a field (float) with the value "1.80" in it. when i pull that value into a php page, the "0" is lopped off, and i just get "1.80" how do I get the entire "1.80" to show (without changing the field to varchar)? thanks Dan Trenz Ann Arbor, MI
i have a table with a field (float) with the value "1.80" in it. when i pull that value into a php page, the "0" is lopped off, and i just get "1.80" how do I get the entire "1.80" to show (without changing the field to varchar)? thanks Dan Trenz Ann Arbor, MI
Mar 26, 2004 Thread starter #2 tristero Programmer Jan 24, 2003 95 US that should read: when i pull that value into a php page, the "0" is lopped off, and i just get "1.8" Dan Trenz Ann Arbor, MI Upvote 0 Downvote
that should read: when i pull that value into a php page, the "0" is lopped off, and i just get "1.8" Dan Trenz Ann Arbor, MI
Mar 26, 2004 #3 Chacalinc Vendor Sep 2, 2003 2,043 US use printf or sprinf: http://cl2.php.net/manual/en/function.sprintf.php Upvote 0 Downvote
Mar 26, 2004 Thread starter #4 tristero Programmer Jan 24, 2003 95 US thank you! if anyone wants an easy currency formatting function... i just added this so i could just do Money($amount) to any currency floats.. Code: function Money($float) { return sprintf("%01.2f", $float); } Dan Trenz Ann Arbor, MI Upvote 0 Downvote
thank you! if anyone wants an easy currency formatting function... i just added this so i could just do Money($amount) to any currency floats.. Code: function Money($float) { return sprintf("%01.2f", $float); } Dan Trenz Ann Arbor, MI
Mar 26, 2004 #5 sleipnir214 Programmer May 6, 2002 15,350 US If you're not running on Win32, there's also the builtin function money_format() Want the best answers? Ask the best questions! TANSTAAFL!! Upvote 0 Downvote
If you're not running on Win32, there's also the builtin function money_format() Want the best answers? Ask the best questions! TANSTAAFL!!