PLEASE HELP! Problem with ODBC string insert
| From: | AKA Hook | Date: | Sun, 15 Jul 2001 17:02:40 +0000 |
| Subject: | PLEASE HELP! Problem with ODBC string insert | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-10417@lists.php.net to get a copy of this message | ||
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...