Re: underscore

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: Matthew Horoschun <mhoroschun(at)canprint(dot)com(dot)au>
Cc: ryanne cruz <ryanne(dot)cruz(at)up(dot)edu(dot)ph>, "\\\"pgsql-php(at)postgresql(dot)org\\\"" <pgsql-php(at)postgresql(dot)org>
Subject: Re: underscore
Date: 2003-01-30 19:33:29
Message-ID: Pine.LNX.4.33.0301301233130.22730-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

On Thu, 30 Jan 2003, Matthew Horoschun wrote:

> Hi Ryanne,
>
> On Thursday, January 30, 2003, at 04:09 PM, ryanne cruz wrote:
>
> > i have a column wherein a lot of entries has 2 or more names int it.
> > these are
> > separated by spaces. an example is: "John Doe", "Mary Margaret Smith".
> > i need
> > to replace the spaces with an underscore. any idea how to do this?
>
>
> In PHP use preg_replace (http://php.net/preg_replace for details)
>
> In PostgreSQL use replace(string text, from text, to text)
>
> (http://www.postgresql.org/docs/
> view.php?version=7.3&idoc=1&file=functions-string.html)
>
> To update a column in a table, you could do something like:
>
> UPDATE table SET column = REPLACE( column, ' ', '_' );

For something like this str_replace is easier to use and generally faster.

In response to

Browse pgsql-php by date

  From Date Subject
Next Message David C. Brown 2003-01-30 19:45:31 Re: populating db with PHP
Previous Message Bruce Becker 2003-01-30 18:35:54 populating db with PHP