FAQ  |  Search  |  Register  |  Profile  |  Log in to check your private messages  |  Log in

Add code for decimal places

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
newphpcoder
-


Joined: 24 Sep 2010
Posts: 2

PostPosted: Mon Nov 22, 2010 2:53 am    Post subject: Add code for decimal places Reply with quote

Good day!

I want to know where I can put this code :
[PHP]
number_format($num), 2;
[/PHP]

I have this code:
[PHP]
echo mysql_result ($result,$ctr,"inputqty");
[/PHP]

I want the output if this code is in 2 decimal places for example the output in this code is: 1.9856211 I want to become is like this 1.99

I hope somebody can help me...thank you..
Back to top
View user's profile Send private message
Toasty
-


Joined: 21 Feb 2008
Posts: 287
Location: Chicago, IL

PostPosted: Tue Dec 21, 2010 2:40 am    Post subject: Reply with quote

Code:

echo round($value*100)/100;

_________________
Portfolio: Robert Lerner
Back to top
View user's profile Send private message Visit poster's website
markspenser
-


Joined: 23 Jul 2009
Posts: 14

PostPosted: Fri Dec 24, 2010 7:55 am    Post subject: Reply with quote

@newphpcoder Had the shared code helped you?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group