pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: ryanne cruz <ryanne.cruz@up.edu.ph>
To: jlarson@candlefire.org <jlarson@candlefire.org>
To: pgsql-php@postgresql.org
Subject: Re: rtrim
Date: Wed, 22 Jan 2003 14:41:28 +0800
Message-ID: <1043217688.3e2e3d1880fb9@mail.up.edu.ph> (raw)
In-Reply-To: <3E2E3872.9080901@candlefire.org>
References: <1043216728.3e2e39585c6f3@mail.up.edu.ph>
	<3E2E3872.9080901@candlefire.org>

Thanks Jason.  
  
but my data in that column varies. what i mean is that not all data ends in ",  
USA". some ends in ", Italy" or ", England". if i understood your code right,  
this only works when all my data ends with ", USA" or any country with 3  
letters on it. anymore ideas?  
 
 
  
Quoting Jason k Larson <jlarson@candlefire.org>:  
  
> rtrim and ltrim are used to remove whitespaces.  I'm not certain why you   
> are getting unpredictable behavior, but try this instead.  
>   
> $column = substr ($column, 0, strlen($column)-5); // 5 = ', USA'  
>   
> http://www.php.net/manual/en/function.substr.php  
>   
> HTH,  
> Jason k Larson  
>   
>   
> ryanne cruz wrote:  
>   
> >  
> > hi list.  
> >  
> > if there's anyone here who's familiar with teh rtrim function, please   
> > i need  
> > help.  
> >  
> > i have a table that has a column in it that has data in this format:  
> >  
> > California, USA  
> > Nevada, USA  
> > .  
> > .  
> > .  
> >  
> > when i use rtrim to erase the ", USA" part, it only sometimes work. a   
> > sample  
> > result would be:  
> >  
> > California  
> > Nevad  
> >  
> > my query statement is:  
> > update table set name=rtrim(name,', USA');  
> >  
> > why is it that it only works sometimes?   
>   
>   
  
  



view thread (5+ messages)  latest in thread

Message-ID: <1043217688.3e2e3d1880fb9@mail.up.edu.ph>
Permalink:  ../1043217688.3e2e3d1880fb9@mail.up.edu.ph/
Also on:    postgresql.org/message-id/1043217688.3e2e3d1880fb9@mail.up.edu.ph

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: ryanne.cruz@up.edu.ph, jlarson@candlefire.org
  Subject: Re: rtrim
  In-Reply-To: <1043217688.3e2e3d1880fb9@mail.up.edu.ph>
  References: <1043216728.3e2e39585c6f3@mail.up.edu.ph> <3E2E3872.9080901@candlefire.org> <1043217688.3e2e3d1880fb9@mail.up.edu.ph>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox