thousand seperator prob

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
joecrack
Forum Commoner
Posts: 99
Joined: Mon Oct 31, 2005 9:17 pm

thousand seperator prob

Post by joecrack »

i usually use this code to get the number format that i want:

Code: Select all

$jan['to_sam_jan']=number_format($jan['to_sam_jan'],2, '.', ',');
But when i get my data like this:

Code: Select all

echo "</tr>";
  while ($row = mysql_fetch_row($ergebnis)){
    echo "<tr>";
    for ($i = 0; $i < mysql_num_fields($ergebnis); $i++){
      echo "<td align=\"center\">$row[$i]</td>";
    }
    echo "</tr>";
I dont know how to include the "number format" in there!?!:?
Anyone got an idea?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

$row[$i] = number_format(yadda,yadda);
:?:
joecrack
Forum Commoner
Posts: 99
Joined: Mon Oct 31, 2005 9:17 pm

Post by joecrack »

sorry - i didnt tel you that there is a bunch of data comin in one $row.
so if i do it like that - also for example the 'date' fields that i have in it will change.
i could look in every row for numbers that are like #####.## and only change those ....
with array_search - but how can i look for those types?
Post Reply