PHP

Moderators: None (Apply to moderate this forum)
Number of threads: 1848
Number of posts: 5016

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Add code for decimal places Posted by newphpcoder on 21 Nov 2010 at 6:59 PM
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..
Report
Re: Add code for decimal places Posted by stephen_sween on 3 Feb 2011 at 6:07 PM
Hi your almost there!

number_format($num,'2','.'.'');

This will print out the result you want!

Stephen



 

Recent Jobs