Php / Mysql number formating -
this question has answer here:
- print currency number format in php 5 answers
i trying have output displayed commas in number. sure im being stupid cannot think of how make work. looking format number output prices. appreciated.
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>"; }
straight source: http://www.php.net/manual/en/function.money-format.php
$number = 1234.56; // let's print international format en_us locale setlocale(lc_monetary, 'en_us'); echo money_format('%i', $number) . "\n"; // usd 1,234.56
Comments
Post a Comment