Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Precision problem with PHP/MySql...

Status
Not open for further replies.

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
 
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
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top