Better Formatting Options?
| From: | sono-io at fannullone dot us | Date: | Fri, 31 Jul 2009 00:52:23 +0000 |
| Subject: | Better Formatting Options? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-296087@lists.php.net to get a copy of this message | ||
Is there a more efficient way to write the following?
<?php $result = mysql_query("SELECT priceList FROM catalog WHERE itemid='ABC1'",$db);
printf("<i>List: <s>%s</s></i><br />\n", money_format('$%i', mysql_result($result,0,"priceList"))); ?>
I have many products per page and this code pulls the list price and formats it. It works fine, but I'd like to know if I can shorten it.
I've looked at number_format over money_format and it's a little shorter, but not by much. Are there better options than printf and mysql_result for my use?
Thanks,
Frank