Forum Moderators: coopster
1) Color the text display of $strPrice to RED.
2) Display the $strPrice to be formated like $2,380 instead of $2380.95 (Adding thousand comma and removing the two decimals)
Can some body please help me on this.
<?php
$strPrice = $currency_logo . " " . $arr_row["item_price"];if ($currency_id <> 1)
{
$curresult = mysql_query("select currency_id, currency_abbr, currency_buyingrate,currency_sellingrate from currencytype where currency_id=$currency_id");
if (mysql_num_rows($curresult))
{
$currencyrow = mysql_fetch_array($curresult);
$intPrice = round($arr_row["item_price"] / $currencyrow["currency_sellingrate"],2) ;
$strPrice = $currency_logo . "" .$intPrice ;
}
}?>
<?print ($strPrice);?>
You can use <p> <span> instead and also use style to make it much more appropriate. That was to show you what you can do generally.
Number Format [php.net] should do the trick.
Habtom
I try to use the full format <?php just to avoid future incompatability and small time headaces.
<?php
$strPrice = $currency_logo . " " . $arr_row["item_price"];if ($currency_id <> 1)
{
$curresult = mysql_query("select currency_id, currency_abbr, currency_buyingrate,currency_sellingrate from currencytype where currency_id=$currency_id");
if (mysql_num_rows($curresult))
{
$currencyrow = mysql_fetch_array($curresult);
$intPrice = round($arr_row["item_price"] / $currencyrow["currency_sellingrate"],2) ;
$strPrice = $currency_logo . "" .$intPrice ;
}
}
?><font color=red>
<?php
// $strPrice = number_format($strPrice, 0);
// $strPrice = number_format($strPrice);
print ($strPrice);
?>