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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Showing decimal places.

Status
Not open for further replies.

MichaelLewis

Programmer
Feb 5, 2011
12
FR
I'm using
$Bal = ($Bal - $row[3]);
and
<input readonly size=\"10\" style=\"color:black;text-align:right\" value=\"$Bal\">
to show the balance of the account.
How can I ensure I always get 2 decimal places,
e.g. 25.00 and not the 25 which I presently get.

Thanks,
Michael
 
No. This doesn't work. Maybe $Bal result is xxxx.xx but the print on the screen using the "<input..." below results in xxxx (no decimal portion). The value=\"$Bal\" always gives me xxxx if the decimal portion is 0. I guess my question wasn't clear. It is in the print on the screen that I want to see the decimal places. Come to think of it I also want comma separaters as in money, i.e. xxx,xxx.xx
There is probably a way to give this format in the "<input..." but I don't know how and I can't find anything in W3Schools or elsewhere.

<input readonly size=\"10\" style=\"color:black;text-align:right\" value=\"$Bal\">

Thanks,
Michael
 
That isn't Microsoft SQL Server language, that is HTML. You need to post your question in an HTML forum, since this forum is for Microsoft SQL Server.

-SQLBill

The following is part of my signature block and is only intended to be informational.
Posting advice: FAQ481-4875
 
Sorry for posting to the wrong forum.
Thanks for the correct forum reference.
Michael
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top