Jump to content


Photo

format number on echo row


  • Please log in to reply
4 replies to this topic

#1 pwaterma

pwaterma
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 11 May 2006 - 03:04 AM

I am having a heck of a time finding out how to format numbers displayed from a query. Can someone show me how to make format Salary with commas?

Much appreciated

<td><?php echo $row_Recordset1['Salary']; ?></td>
<td><?php echo $row_Recordset1['Cap_hit']; ?></td>
<td><?php echo $row_Recordset1['Cap_hit_preJune']; ?></td>
<td><?php echo $row_Recordset1['Cap_hit_postJune']; ?></td>

#2 toplay

toplay
  • Staff Alumni
  • Advanced Member
  • 973 posts

Posted 11 May 2006 - 03:12 AM

Look at using one of these two functions:

[a href=\"http://us2.php.net/number_format\" target=\"_blank\"]http://us2.php.net/number_format[/a]

[a href=\"http://us2.php.net/manual/en/function.money-format.php\" target=\"_blank\"]http://us2.php.net/manual/en/function.money-format.php[/a]



#3 pwaterma

pwaterma
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 11 May 2006 - 03:32 AM

[!--quoteo(post=373164:date=May 10 2006, 08:12 PM:name=toplay)--][div class=\'quotetop\']QUOTE(toplay @ May 10 2006, 08:12 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Look at using one of these two functions:

[a href=\"http://us2.php.net/number_format\" target=\"_blank\"]http://us2.php.net/number_format[/a]

[a href=\"http://us2.php.net/manual/en/function.money-format.php\" target=\"_blank\"]http://us2.php.net/manual/en/function.money-format.php[/a]
[/quote]


i have looked at these and others. they all appear to be formatting a value that is manually defined.

$number = 1234.56;

i don't understand how to apply it to $row_Recordset1['Salary'];

#4 toplay

toplay
  • Staff Alumni
  • Advanced Member
  • 973 posts

Posted 11 May 2006 - 03:48 AM


<td><?php echo number_format($row_Recordset1['Salary']); ?></td>

#5 pwaterma

pwaterma
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 11 May 2006 - 04:08 AM

[!--quoteo(post=373167:date=May 10 2006, 08:48 PM:name=toplay)--][div class=\'quotetop\']QUOTE(toplay @ May 10 2006, 08:48 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
<td><?php echo number_format($row_Recordset1['Salary']); ?></td>
[/quote]

perfect thank you so much!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users