Habtom

msg:3480670 | 10:05 am on Oct 18, 2007 (gmt 0) |
<font color="red"> <?php print ($strPrice);?> </font> 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.
|
Robert Poole

msg:3480671 | 10:07 am on Oct 18, 2007 (gmt 0) |
1) change <?print ($strPrice);?> to maybe <? print "<font color='#cc0000'>".$strPrice."</font>";?> 2) slip in a line before you print strPrice like $strPrice = number_format($strPrice, 0); Go team.
|
smartcard

msg:3480694 | 10:22 am on Oct 18, 2007 (gmt 0) |
Habtom, Thanks for the reply. The font color is working fine now. But the number format I am lost, since I am using the "php print" command I don't know how to incorporate it with my codes. Appreciate for any further help.
|
Habtom

msg:3480699 | 10:28 am on Oct 18, 2007 (gmt 0) |
Like Robert Poole mentioned above, you can do the following: Replace this part: <?print ($strPrice);?> With the following: <font color=red> <?php $strPrice = number_format($strPrice, 0); print ($strPrice); ?> </font> Habtom
|
smartcard

msg:3480701 | 10:31 am on Oct 18, 2007 (gmt 0) |
Robert Poole, the following is not working it is giving "0" value result. "slip in a line before you print strPrice like $strPrice = number_format($strPrice, 0);" |
| I even tired the following, but no luck: "slip in a line before you print strPrice like $strPrice = number_format($strPrice);" |
|
|
Robert Poole

msg:3480705 | 10:46 am on Oct 18, 2007 (gmt 0) |
okay, so do it without the ,'0' on the end so like... $strPrice = number_format($strPrice)
|
smartcard

msg:3480707 | 10:51 am on Oct 18, 2007 (gmt 0) |
I did, but still result is 0 $strPrice = number_format($strPrice);"
|
Robert Poole

msg:3480711 | 10:54 am on Oct 18, 2007 (gmt 0) |
Then I would double check that you're not getting 0 anyway. Comment out the number format line and make sure you're getting a proper answer and not 0.
|
smartcard

msg:3480715 | 11:04 am on Oct 18, 2007 (gmt 0) |
When I Comment out the number format line I am getting the amount but not formated eg: $2380.95 I need it as $2,380
|
Robert Poole

msg:3480724 | 11:22 am on Oct 18, 2007 (gmt 0) |
hmmm... might be because you've already used the round function on a previous line. maybe try taking that out... you shouldn't need it.
|
Habtom

msg:3480729 | 11:26 am on Oct 18, 2007 (gmt 0) |
Can you post the current code you have, after you put in what we discussed earlier?
|
deMorte

msg:3480733 | 11:30 am on Oct 18, 2007 (gmt 0) |
$strPrice is a string, right? You can only use the number_format on float numbers. You should do the number format on the number only ($intPrice) and add the currency sign after that.
|
smartcard

msg:3480742 | 11:49 am on Oct 18, 2007 (gmt 0) |
Following is the current code: <?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); ?> |
|
|
Habtom

msg:3480747 | 11:56 am on Oct 18, 2007 (gmt 0) |
deMorte's answer is I think the solution to the problem. It is caused because of the $ sign you have in the number. [edited by: Habtom at 12:45 pm (utc) on Oct. 18, 2007]
|
smartcard

msg:3480780 | 12:44 pm on Oct 18, 2007 (gmt 0) |
Yes, deMorte's answer solved the problem. Thanks a lot for you all great helpful people on this forum.
|
|