Re: Automatic Addslashes - Mailing list pgsql-general

From GH
Subject Re: Automatic Addslashes
Date
Msg-id 20001124064216.D34282@over-yonder.net
Whole thread Raw
In response to Automatic Addslashes  ("Enrico Comini" <algobit@algobit.com>)
List pgsql-general
On Fri, Nov 24, 2000 at 01:29:41PM +0100, some SMTP stream spewed forth:
> I do
>
> copy tmp from '/home/algobit/product.txt
>
> tmp ia a table with one record (line varchar(255))
>
> in product.txt I have many line as:
>
> 2;"100";"Parmigiano Reggiano";"Parmigiano Reggiano stagionato 2
> anni";4;"parmigiano4.jpg";2;"Fette 1 Kg";0.18;1;1.00;"true"
>
> Then with "select * from tmp" the result is exactly like in the original
> file
>
> 2;"100";"Parmigiano Reggiano";"Parmigiano Reggiano stagionato 2
> anni";4;"parmigiano4.jpg";2;"Fette 1 Kg";0.18;1;1.00;"true"
>
> But when i fetch in a variable the rercords (with php) i READ in the
> variable
>
> 2;\"100\";\"Parmigiano Reggiano\";\"Parmigiano Reggiano stagionato 2
> anni\";4;\"parmigiano4.jpg\";2;\"Fette 1 Kg\";0.18;1;1.00;\"true\"
>
> the question is : The SLASH are effectively in the record ?

Not if, as you say, a regular non-php select returns the "original"
record. Likely, your PHP setup has magic_quotes_runtime (or
magic_quotes_gpc) set to On. This would cause PHP to "addslashes()" to
the data gathered from the db (also true for forms, etc).

Make sense?

You can use get_magic_quotes_runtime or get_magic_quotes_gpc to retrieve
the current setting of the two options.

http://www.php.net/manual/configuration.php#ini.magic-quotes-gpc
gives a nice summary.

cheers.

gh

>

pgsql-general by date:

Previous
From: Pawel Dubin
Date:
Subject: Re: plz, Help!! HOW CAN I GET THE ROWNUM IN POSTGRES TABLE AS I DID WITH ORACLE!!
Next
From: Don Baccus
Date:
Subject: Re: [HACKERS] RE: PHPBuilder article -- Postgres vs MySQL