Jump to content

[SOLVED] how to get value for 2 decimal point!!!!!


new_php85

Recommended Posts

iii.... see again

 

i make some calculation...when i sum all (salary) the value is correct but it appear like this eg:223632.2321451255 (see code a). i just want the 'total_ee' like 223632.23 which is 2 decimal point.

 

a)

$q2 = "SELECT SUM(ammount_ee) AS total_ee FROM ee WHERE staff_id='$staff_id'";
$result2 = mysql_query($q2) or die('Query failed. ' . mysql_error());
$row2 = mysql_fetch_array($result2);

echo $row2['total_ee']

 

 

below some code that i have wrote. but after i add $num2 = number_format($row2, 2), the amount = 1 (see code b)

 

b)

 

$q2 = "SELECT SUM(ammount_ee) AS total_ee FROM ee WHERE staff_id='$staff_id'";
$result2 = mysql_query($q2) or die('Query failed. ' . mysql_error());
$row2 = mysql_fetch_array($result2);
$num2 = number_format($row2, 2);

echo $num['total_ee']

 

how to make  total_ee become 2 decimal point??? ??? ??? ???

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.