Re: PLEASE HELP! Problem with ODBC string insert

From: Date: Sun, 15 Jul 2001 19:56:27 +0000
Subject: Re: PLEASE HELP! Problem with ODBC string insert
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-10424@lists.php.net to get a copy of this message
Here is the echo output. UPDATE News SET NewsTitle = 'Text', NewsText = 'can\'t use quotes!' WHERE NewsID = 16 "Matthew Loff" <matt@willetts.com> wrote in message news:000e01c10d89$6fa576c0$0100a8c0@bang... > > It might help us to see exactly what the query is... > > Could you insert an echo statement and let us know what SQL query it's > producing? > > echo " > INSERT INTO News > (NewsDate,NewsTitle,NewsText) > VALUES > ('$NowDate','$NewsTitle','$NewsText') > "; > > > -----Original Message----- > From: AKA Hook [mailto:aka_hook@hotmail.com] > Sent: Sunday, July 15, 2001 1:03 PM > To: php-db@lists.php.net > Subject: [PHP-DB] PLEASE HELP! Problem with ODBC string insert > > > I am using an Access DBASE and trying to insert text from a form field. > When I use quotes in my text the code errors out, otherwise it works > fine. I have Magic Quotes turned on which is supposed to fix this > problem but IT DOES NOT! > > I have posted in several forums but no one has been able to help me! > Here is my code: > ------------------------------------------------------------------------ > ---- > -- > > $NowDate = date("m/d/y"); > > $DBASE = odbc_connect(mno,admin,admin); > $getnews = odbc_exec($DBASE, > " > INSERT INTO News > (NewsDate,NewsTitle,NewsText) > VALUES > ('$NowDate','$NewsTitle','$NewsText') > " > ); > > Here is the error when using quotes in the "NewsText" form field: > ------------------------------------------------------------------------ > ---- > ---- > Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax > error (missing operator) in query expression ''can\'t use quotes!')'., > SQL state 37000 in SQLExecDirect in W:\www\clanmno\news_post2.php on > line 22 > > Thanks in advance... > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.db (#10424) next »