Re: Automatic Addslashes

From: GH <grasshacker(at)over-yonder(dot)net>
To: Enrico Comini <algobit(at)algobit(dot)com>
Cc: ML-Postrges-general <Pgsql-General(at)Postgresql(dot)org>
Subject: Re: Automatic Addslashes
Date: 2000-11-24 12:42:16
Message-ID: 20001124064216.D34282@over-yonder.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message ghaverla 2000-11-24 12:54:12 Re: Skipping numbers in a sequence.
Previous Message Enrico Comini 2000-11-24 12:29:41 Automatic Addslashes