Re: Double Quotes In Queries

From: Date: Wed, 27 Apr 2005 20:10:03 +0000
Subject: Re: Double Quotes In Queries
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-18968@lists.php.net to get a copy of this message
On 4/27/05, pw <p.willis@telus.net> wrote: > Justin Patrin wrote: > > On 4/27/05, pw <p.willis@telus.net> wrote: > > > >>Hello, > >> > >>I have pearDB connected to PostgreSQL. > >> > >>When I make an insert into a varchar field everything works fine, > >>**UNLESS** I have double quotes in my data for that field. > >> > >>For example if I use the following INSERT directly in postgres it works > >>fine: > >> > >>INSERT INTO mytable (a_text_field) VALUES ( 'one 19" monitor' ); > >> > >>However if I use pear and PHP to insert this record the data gets > >>truncated to > >> > >>'one 19' > >> > >>Even adding a backslash as an escape character doesn't resolve the problem. > >>ie:INSERT INTO mytable (a_text_field) VALUES ( 'one 19\" monitor' ); > >> > >>I think I must be missing something in my php.ini or something. > >>Is there a flag for this? > >> > > > > > > Try using DB::quoteSmart(). > > > > Hello, > > Thanks for your help. > quoteSmart doesn't appear to fix the problem. > > Do I run the complete query string through quoteSmart > or just the field data? > > So far I've just run the field data through which adds > a slash in front of the double quote. (just like my previous experiments) > Just field data. Read the manual page for that function. Could you post the code where you create your query? -- Justin Patrin

« previous php.pear.general (#18968) next »