Re: SQL woes (newbie question) - PHP 4.3.6 & ADOdb
| From: | Gabe | Date: | Wed, 28 Apr 2004 14:16:14 +0000 |
| Subject: | Re: SQL woes (newbie question) - PHP 4.3.6 & ADOdb | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-184876@lists.php.net to get a copy of this message | ||
Torsten Roehr wrote:
"Gabe" <ydnahg-news4432@mailblocks.com> wrote in message news:20040427195929.65268.qmail@pb1.pair.com...Hi Torsten, I tried using that function this morning like you suggested, but when I ran it I suddenly realized that I'm running an Access db not a mysql db. The function asks for a resource connection to a mysql db. Is there a similar function that you know of that will do the same thing for an access query? Many thanks! GabeTorsten Roehr wrote:look"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 aThis should do the trick: http://de3.php.net/manual/en/function.stripslashes.php Regards, Torstenhere: http://de3.php.net/manual/en/function.mysql-real-escape-string.php Regards, TorstenThanks for the link, looks like that will do the trick. But I was also wondering then, when I use a SELECT statement to retrieve the same data and display it, is there a function that will remove all the escape characters? I didn't see anything in the mysql function list.Thanks! Gabe