Re: SQL woes (newbie question) - PHP 4.3.6 & ADOdb
| From: | Torsten Roehr | Date: | Tue, 27 Apr 2004 19:48:41 +0000 |
| Subject: | Re: SQL woes (newbie question) - PHP 4.3.6 & ADOdb | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-184797@lists.php.net to get a copy of this message | ||
"Gabe" <ydnahg-news4432@mailblocks.com> wrote in message
news:20040427194223.85721.qmail@pb1.pair.com...
> I seem to be having some trouble getting my SQL statement to work
> properly. I'm trying to get it so that I can have any text between the
> single quotes. So as you can see below, if the text that needs to get
> updated has a single quote in it, I get an error when trying to execute
> the statement. The database I'm using is Access, the field type is
> "memo", and I'm using the ADOdb library. In my example below I'm using
> a really short string. But in actuality it could be *extrememly* long,
> and would contain HTML code (thus there would be many single quotes and
> double quotes). Any ideas so that I can get anything between the single
> quotes to be seen as text to be updated and not something to be
> processed? I've tried using double quotes and backticks instead of the
> single quotes around the text.
>
>
> UPDATE tblFAQ_Question SET fldBody = '<span style='color: #000000;'>hi,
> what's going on?</span>' WHERE autoQuesID = $intQuestionID;
You have got to escape all quotes BEFORE using it in a query. Take a look
here:
http://de3.php.net/manual/en/function.mysql-real-escape-string.php
Regards, Torsten
>
> Thanks!
>
> Gabe