H-

Thanks to those that emailed. 

$query = "tree, bird, nest, ";
$new = substr($query,0,2);

Doesn't seem to work. It returns "tr". 

I think maybe I should also mention that to get this variable I have an
array that is placed through a for loop 
// file://loop through array
 for($i = 0;$i <$num;$i++){
   print $fields[$i] . "<br>";
   $query .= "$fields[$i], ";
  }

That's where I get $query from. It's been returned from a multiple
select via a web form. 
I want to format this selected data into a query string so I can plug it
into a SQL statement. 

Thanks for the input and if any one has any thoughts on the subject
appreciate the assistance. 
-Sterling



Sterling wrote:
> 
> H-
> 
> Well here's a pattern replace issue which I've been working on without
> success hence the post. 8^)
> 
> I have a variable that has stuff in it (tree, bird, nest, )(yes there is
> a trailing space)
> 
> What I'd like to do is strip off the last ', ' and replace it with a
> single space so that I have
> (tree, bird, nest )
> 
> I thought I had it with a simple substr_replace but it only returned my
> replace character.
> 
> I thought that ereg_replace would work but got infinitly lost with the
> []\s(.) stuff.
> 
> If I was in perl I'd do something like (s/,.$/ /ig). I think. Never
> fully grasped the pattern stuff anyway. 8^/
> 
> But anywhoo... if anyone has any ideas send them along. Any help would
> be greatly appreciated.
> 
> Thanks.
> -Sterling
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to