[snip]
Not sure if this is the right place to ask. But here it goes. I'm using PHP
4.0.6 and trying to find a way to insert single quoted data. Some of the
values in the INSERT statement are single, double quoted, or use
backslashes. I cannot seem to use an escape character to input these special
characters into an Access database using ODBC. Here's the resulting error:

Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax error
in query expression ''[\']hello[\']', SQL state 37000 in SQLExecDirect in
c:\inetpub\wwwroot\blah.php on line 23 INSERT INTO blah (id, title)  VALUES
(10,'[\']hello[\']')

The original string was [']hello['].
If you can help I would greatly appreciate it, if not could you direct me to
the appropriate place.
[/snip]

Are magic quotes turned on in your php.ini? If so you do not have to escape
quotes, they are escaped magically for you. A better bet is to turn magic
quotes off and use addslashes();

http://www.php.net/manual/en/function.addslashes.php

HTH!

Jay

***********************************************************
* Texas PHP Developers Conf  Spring 2003                  *
* T Bar M Resort & Conference Center                      *
* New Braunfels, Texas                                    *
* San Antonio Area PHP Developers Group                   *
* Interested? Contact [EMAIL PROTECTED] *
***********************************************************



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to