pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Re(2): Test (fwd)
6+ messages / 5 participants
[nested] [flat]

* Re(2): Test (fwd)
@ 2001-06-14 17:12  Gary Hoffman <ghoffman@ucsd.edu>
  0 siblings, 1 reply; 6+ messages in thread

From: Gary Hoffman @ 2001-06-14 17:12 UTC (permalink / raw)
  To: pgsql-php; +Cc: aalang@rutgersinsurance.com

aalang@rutgersinsurance.com writes:
>
>Plus, you have to make sure to check for apostrophes.  That will break
>your
>SQL statement if someone typed them into the text field.
>

Well, this caveat had never occured to me. So how does someone enter
strings with enclosed apostrophes, as in the Irish surname O'Mallory or
the Yemeni placename Sana'a?

Gary

**************************************************************************
* Gary B. Hoffman, Computing Services Manager  e-mail: ghoffman@ucsd.edu *
* Graduate School of International Relations and Pacific Studies (IR/PS) *
* University of California, San Diego (UCSD)       voice: (858) 534-1989 *
* 9500 Gilman Dr. MC 0519                            fax: (858) 534-3939 *
* La Jolla, CA 92093-0519 USA             web: http://www-irps.ucsd.edu/ *
**************************************************************************






^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Re(2): Test (fwd)
@ 2001-06-14 17:28  Adam Lang <aalang@rutgersinsurance.com>
  parent: Gary Hoffman <ghoffman@ucsd.edu>
  0 siblings, 1 reply; 6+ messages in thread

From: Adam Lang @ 2001-06-14 17:28 UTC (permalink / raw)
  To: pgsql-php

It could fluctuate on each database, so always check the appropriate
documentation, but...

the standard way usually is to double the apostrophe

O'Brien would be O''Brien  (the middle is two apostrophes, not a quote)

Adam Lang
Systems Engineer
Rutgers Casualty Insurance Company
http://www.rutgersinsurance.com
----- Original Message -----
From: "Gary Hoffman" <ghoffman@ucsd.edu>
To: <pgsql-php@postgresql.org>
Cc: <aalang@rutgersinsurance.com>
Sent: Thursday, June 14, 2001 1:12 PM
Subject: Re(2): [PHP] Test (fwd)


> aalang@rutgersinsurance.com writes:
> >
> >Plus, you have to make sure to check for apostrophes.  That will break
> >your
> >SQL statement if someone typed them into the text field.
> >
>
> Well, this caveat had never occured to me. So how does someone enter
> strings with enclosed apostrophes, as in the Irish surname O'Mallory or
> the Yemeni placename Sana'a?
>
> Gary
>
> **************************************************************************
> * Gary B. Hoffman, Computing Services Manager  e-mail: ghoffman@ucsd.edu *
> * Graduate School of International Relations and Pacific Studies (IR/PS) *
> * University of California, San Diego (UCSD)       voice: (858) 534-1989 *
> * 9500 Gilman Dr. MC 0519                            fax: (858) 534-3939 *
> * La Jolla, CA 92093-0519 USA             web: http://www-irps.ucsd.edu/ *
> **************************************************************************
>
>




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Re(2): Test (fwd)
@ 2001-06-14 18:25  Timothy_Maguire@hartehanks.com
  0 siblings, 1 reply; 6+ messages in thread

From: Timothy_Maguire@hartehanks.com @ 2001-06-14 18:25 UTC (permalink / raw)
  To: Adam Lang <aalang@rutgersinsurance.com>; +Cc: pgsql-php; pgsql-php-owner@postgresql.org


you can use the addslashes() function.  This will make O'Brien O\'Brien and
the db will take it.  In php4 this happens by default

Tim.

Timothy P. Maguire
Web Developer II
Harte-Hanks
978 436 3325



                                                                                                         
                    "Adam Lang"                                                                          
                    <aalang@rutgersinsur       To:     <pgsql-php@postgresql.org>                        
                    ance.com>                  cc:                                                       
                    Sent by:                   Subject:     Re: Re(2): Test (fwd)                        
                    pgsql-php-owner@post                                                                 
                    gresql.org                                                                           
                                                                                                         
                                                                                                         
                    06/14/01 01:28 PM                                                                    
                                                                                                         
                                                                                                         




It could fluctuate on each database, so always check the appropriate
documentation, but...

the standard way usually is to double the apostrophe

O'Brien would be O''Brien  (the middle is two apostrophes, not a quote)

Adam Lang
Systems Engineer
Rutgers Casualty Insurance Company
http://www.rutgersinsurance.com
----- Original Message -----
From: "Gary Hoffman" <ghoffman@ucsd.edu>
To: <pgsql-php@postgresql.org>
Cc: <aalang@rutgersinsurance.com>
Sent: Thursday, June 14, 2001 1:12 PM
Subject: Re(2): [PHP] Test (fwd)


> aalang@rutgersinsurance.com writes:
> >
> >Plus, you have to make sure to check for apostrophes.  That will break
> >your
> >SQL statement if someone typed them into the text field.
> >
>
> Well, this caveat had never occured to me. So how does someone enter
> strings with enclosed apostrophes, as in the Irish surname O'Mallory or
> the Yemeni placename Sana'a?
>
> Gary
>
>
**************************************************************************
> * Gary B. Hoffman, Computing Services Manager  e-mail: ghoffman@ucsd.edu
*
> * Graduate School of International Relations and Pacific Studies (IR/PS)
*
> * University of California, San Diego (UCSD)       voice: (858) 534-1989
*
> * 9500 Gilman Dr. MC 0519                            fax: (858) 534-3939
*
> * La Jolla, CA 92093-0519 USA             web: http://www-irps.ucsd.edu/
*
>
**************************************************************************
>
>


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster






^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Re(2): Test (fwd)
@ 2001-06-14 22:57  Mitch Vincent <mvincent@cablespeed.com>
  parent: Adam Lang <aalang@rutgersinsurance.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Mitch Vincent @ 2001-06-14 22:57 UTC (permalink / raw)
  To: pgsql-php

    The apostrophe being a special character in PostgreSQL (and most other
databases), it needs to be escaped if you wish it to go nicely into a
query..
addslashes() and related functions will help there.

    Another thing to keep in mine is htmlspecialchars() -- it's very useful
when someone might put a double quote in your form field -- which could
seriously mess up when you have something like <INPUT TYPE="TEXT"
NAME="Whatever" VALUE="this is what I'm "talking" about"> , sort of thing.

    I missed the first post so please excuse me if I'm way off base.. Good
luck!

-Mitch


----- Original Message -----
From: "Adam Lang" <aalang@rutgersinsurance.com>
To: <pgsql-php@postgresql.org>
Sent: Thursday, June 14, 2001 1:28 PM
Subject: Re: Re(2): [PHP] Test (fwd)


> It could fluctuate on each database, so always check the appropriate
> documentation, but...
>
> the standard way usually is to double the apostrophe
>
> O'Brien would be O''Brien  (the middle is two apostrophes, not a quote)
>
> Adam Lang
> Systems Engineer
> Rutgers Casualty Insurance Company
> http://www.rutgersinsurance.com
> ----- Original Message -----
> From: "Gary Hoffman" <ghoffman@ucsd.edu>
> To: <pgsql-php@postgresql.org>
> Cc: <aalang@rutgersinsurance.com>
> Sent: Thursday, June 14, 2001 1:12 PM
> Subject: Re(2): [PHP] Test (fwd)
>
>
> > aalang@rutgersinsurance.com writes:
> > >
> > >Plus, you have to make sure to check for apostrophes.  That will break
> > >your
> > >SQL statement if someone typed them into the text field.
> > >
> >
> > Well, this caveat had never occured to me. So how does someone enter
> > strings with enclosed apostrophes, as in the Irish surname O'Mallory or
> > the Yemeni placename Sana'a?
> >
> > Gary
> >
> >
**************************************************************************
> > * Gary B. Hoffman, Computing Services Manager  e-mail: ghoffman@ucsd.edu
*
> > * Graduate School of International Relations and Pacific Studies (IR/PS)
*
> > * University of California, San Diego (UCSD)       voice: (858) 534-1989
*
> > * 9500 Gilman Dr. MC 0519                            fax: (858) 534-3939
*
> > * La Jolla, CA 92093-0519 USA             web: http://www-irps.ucsd.edu/
*
> >
**************************************************************************
> >
> >
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Re: Re(2): Test (fwd)
@ 2001-06-14 23:00  Mitch Vincent <mvincent@cablespeed.com>
  parent: Timothy_Maguire@hartehanks.com
  0 siblings, 0 replies; 6+ messages in thread

From: Mitch Vincent @ 2001-06-14 23:00 UTC (permalink / raw)
  To: pgsql-php

> you can use the addslashes() function.  This will make O'Brien O\'Brien
and
> the db will take it.  In php4 this happens by default

    Not really by default, it's a configuration option to have that happen
to data coming from forms. I forget the exact name of the parameter in the
php.ini file, but it's something like magic_quotes_runtime or some such
beast.

Just an FYI..





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Re(2): Test (fwd)
@ 2001-06-15 08:30  Frank Joerdens <frank@joerdens.de>
  parent: Mitch Vincent <mvincent@cablespeed.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Frank Joerdens @ 2001-06-15 08:30 UTC (permalink / raw)
  To: Mitch Vincent <mvincent@cablespeed.com>; +Cc: pgsql-php

On Thu, Jun 14, 2001 at 06:57:43PM -0400, Mitch Vincent wrote:
>     The apostrophe being a special character in PostgreSQL (and most other
> databases), it needs to be escaped if you wish it to go nicely into a
> query..
> addslashes() and related functions will help there.
> 
>     Another thing to keep in mine is htmlspecialchars() -- it's very useful
> when someone might put a double quote in your form field -- which could
> seriously mess up when you have something like <INPUT TYPE="TEXT"
> NAME="Whatever" VALUE="this is what I'm "talking" about"> , sort of thing.

Also note that the PHP runtime parameter magic_quotes_gpc is usually on
by default which does the escaping by default.

- Frank



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2001-06-15 08:30 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-06-14 17:12 Re(2): Test (fwd) Gary Hoffman <ghoffman@ucsd.edu>
2001-06-14 17:28 ` Adam Lang <aalang@rutgersinsurance.com>
2001-06-14 22:57   ` Mitch Vincent <mvincent@cablespeed.com>
2001-06-15 08:30     ` Frank Joerdens <frank@joerdens.de>
2001-06-14 18:25 Re: Re(2): Test (fwd) Timothy_Maguire@hartehanks.com
2001-06-14 23:00 ` Mitch Vincent <mvincent@cablespeed.com>

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