0

I am trying to have my output displayed with commas in the number. I am sure im being stupid but I cannot think of how to make it work. I am looking just to format the number output for the prices.

    echo "</tr></table><br>";
    echo mysql_result($result,$i,"shortdescription")."<br><br>";

        echo "<div style=\"background-color:#FDFFDB\">";
        echo "<table border=1 cellpadding=5>";
        echo "<tr>";
        echo "<td class=txt width=200><b>Price low season</b><br><i>May 15th - Nov 30th</i></td>";
        echo "<td class=txt width=200><b>Price high season</b><br><i>Dec 1st - May 14th</i></td>";
        echo "<td class=txt width=200><b>Xmas, New Year &<br>Sailing regattas</b></td>";
        echo "</tr>";
        echo "<tr>";
        echo "<td class=txt>US$ ".mysql_result($result,$i,"pricelownight")." per night</td>";
        echo "<td class=txt>US$ ".mysql_result($result,$i,"pricehighnight")." per night</td>";
    if (mysql_result($result,$i,"pricespecial")){
        echo "<td rowspan=2 class=txt>US$ ".mysql_result($result,$i,"pricespecial")." per week</td>";
    } else {
        echo "<td rowspan=2 class=txt>Price upon request</td>";
    }
Cœur
  • 37,241
  • 25
  • 195
  • 267

1 Answers1

0

Straight from the source: http://www.php.net/manual/en/function.money-format.php

$number = 1234.56;

// let's print the international format for the en_US locale
setlocale(LC_MONETARY, 'en_US');
echo money_format('%i', $number) . "\n";
// USD 1,234.56
dmgig
  • 4,400
  • 5
  • 36
  • 47