Re: Dealing with commas in fields - Mailing list pgsql-general

From scott.marlowe
Subject Re: Dealing with commas in fields
Date
Msg-id Pine.LNX.4.33.0308040927350.10306-100000@css120.ihs.com
Whole thread Raw
In response to Dealing with commas in fields  (MT <mt@open2web.com>)
List pgsql-general
On Fri, 1 Aug 2003, MT wrote:

> Hi,
>
> I'm using Postgresql to store customer and product information. Since
> this is a French language database, some of the names include commas.
> Information entered into this database is via html forms and php
> scripts.
> When I search the database with a partial name that includes a comma,
> such as D'Abcd, the database takes longer to find the record I'm looking
> for than if I searched the database with a partial name that does not
> include a comma, such as Abcd. I' ve also noticed if I D'Abcd in a php
> variable, which is diplayed as the title in the html header, it shows up
> as D\\\'Abcd, if this variable is passed and displayed in the next page,
> it shows up as d\\\\\\\\'Abcd.
>
> Is there a way to enter names with a comma into a field without it
> causing this strange behavior.

This "normal" PHP behaviour with most default installs.  You need to
figure out where in your script you need to add stripslashes and
addslashes to your data.  note that with postgresql, there are specific
functions you should use pg_escape_string, but this function requires
postgresql 7.2 or later, so if you're still on 7.1 you'll need to use
addslashes.

Use stripslashes to unescape the data when it comes back out.


pgsql-general by date:

Previous
From: "Ivar"
Date:
Subject: Re: Is there any place to get 7.4 win binaries ?
Next
From: Joe Conway
Date:
Subject: Re: plPHP -- sort of an announcement.. but not commercial