RIGHT Function?
| From: | sono-io at fannullone dot us | Date: | Thu, 24 Sep 2009 19:01:41 +0000 |
| Subject: | RIGHT Function? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-298334@lists.php.net to get a copy of this message | ||
Hi all,
I could use some help. I've scoured both the MySQL and PHP sites that I know of and can't find an answer to this.
I have a price field that sometimes contains entries like this:
250,(min)
5.32
How can I pull just the price ($5.32 in this example) from this field to display on a web page? Is there a RIGHT function in PHP? When I search the PHP site, I'm being told there isn't one.
Here's the code I've been using:
<?php $result = mysql_query("SELECT priceList,unitprice FROM catalog WHERE itemid='WR-1240'",$db);
printf('List: $%s<br />', number_format(mysql_result($result,0,"priceList"),2));
printf('Your Price: $%s', number_format(mysql_result($result,0,"unitprice"),2)); ?>
Thanks,
Frank