Re: [PHP] RIGHT Function?

2009-11-14 Thread sono-io
On Nov 13, 2009, at 6:34 PM, Jim Lucas wrote: You basic problem with the PHP_EOL is that when echo'ed out, it represents a \n character. The value you are working with might be \n\r or just \r I read the links you sent, plus some others. It took me awhile, but I get it now. If the "ret

Re: [PHP] RIGHT Function?

2009-11-13 Thread Jim Lucas
sono...@fannullone.us wrote: Jim, $parts = explode(PHP_EOL, $item['unitprice']); $price = '$'.(( count($parts) > 1 ) ? $parts[0] : $parts[(count($parts)-1)]); For some reason, I couldn't get explode to work with PHP_EOL. $parts[0] would return the entire field, so apparently it wasn't

Re: [PHP] RIGHT Function?

2009-11-13 Thread sono-io
Jim, $parts = explode(PHP_EOL, $item['unitprice']); $price = '$'.(( count($parts) > 1 ) ? $parts[0] : $parts[(count($parts)-1)]); For some reason, I couldn't get explode to work with PHP_EOL. $parts[0] would return the entire field, so apparently it wasn't "exploding". So I tried exp

Re: [PHP] RIGHT Function?

2009-11-13 Thread sono-io
Hi Jim, $parts = explode(PHP_EOL, $item['unitprice']); $price = '$'.(( count($parts) > 1 ) ? $parts[0] : $parts[(count($parts)-1)]); Thanks for the code! After reading up on PHP_EOL and explode, I now understand what you've done. However, can you tell me why you like this better? Is

Re: [PHP] RIGHT Function?

2009-11-13 Thread Jim Lucas
sono...@fannullone.us wrote: > I think I've solved a problem that I had posted back in September. > Here's a recap: > > == > I need to grab a dollar amount from a text field in a MySQL db that > can contain more information than just the price. Here are 4 examples > o

Re: [PHP] RIGHT Function?

2009-11-13 Thread sono-io
I think I've solved a problem that I had posted back in September. Here's a recap: == I need to grab a dollar amount from a text field in a MySQL db that can contain more information than just the price. Here are 4 examples of what could be in that field: 48,(min)

Re: [PHP] RIGHT Function?

2009-09-25 Thread tedd
At 12:33 PM -0700 9/24/09, sono...@fannullone.us wrote: On Sep 24, 2009, at 12:15 PM, Jay Blanchard wrote: substr will work from right to left. If your data is in a variable do this; Thanks, Jay. That does the job. Frank Frank: I came to this thread a little late, but the follow

Re: [PHP] RIGHT Function?

2009-09-24 Thread sono-io
On Sep 24, 2009, at 12:15 PM, Jay Blanchard wrote: substr will work from right to left. If your data is in a variable do this; Thanks, Jay. That does the job. Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] RIGHT Function?

2009-09-24 Thread Tommy Pham
- Original Message > From: Tommy Pham > To: PHP General List > Sent: Thursday, September 24, 2009 12:19:51 PM > Subject: Re: [PHP] RIGHT Function? > > - Original Message > > From: Jay Blanchard > > To: sono...@fannullone.us; PHP General List &g

Re: [PHP] RIGHT Function?

2009-09-24 Thread Tommy Pham
- Original Message > From: Jay Blanchard > To: sono...@fannullone.us; PHP General List > Sent: Thursday, September 24, 2009 12:15:13 PM > Subject: RE: [PHP] RIGHT Function? > > [snip] > I have a price field that sometimes contains entries like this: > > 25

RE: [PHP] RIGHT Function?

2009-09-24 Thread Jay Blanchard
[snip] 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.

Re: [PHP] RIGHT Function?

2009-09-24 Thread Tommy Pham
Original Message > From: "sono...@fannullone.us" > To: PHP General List > Sent: Thursday, September 24, 2009 12:01:41 PM > Subject: [PHP] RIGHT Function? > > Hi all, > > I could use some help. I've scoured both the MySQL and PHP sites tha

[PHP] RIGHT Function?

2009-09-24 Thread sono-io
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 disp