Subject Re: [firebird-support] PHP and apostrophe-related question
Author Helen Borrie
At 10:27 AM 7/11/2003 +0200, you wrote:
>Hi
>
>I am having trouble querying Firebird for data that may contain apostrophes
>from PHP. I think the problem may be with the PHP interbase functions, and
>wonder if anyone has any experience of doing this?
>
>Escaping the apostrophe with a backslash at the PHP level doesn't help
>(Firebird doesn't recognize the escape sequence).
>
>I have eventually managed to enclose the literal containing the apostrophe
>in double quotes at the PHP level, but now Firebird thinks I'm trying to
>compare two columns.
>
>Surely this must be a common problem with a simple solution. Does anyone
>know what it is?
>
>PS: I have asked on the PHP-DB list, but the response has been poor so far.
>
>Any help is appreciated.
>
>Thanks

It's a lot easier than you think. Just preface the apostrophe with another
apostrophe. The IB/Firebird PHP-thingy should have some kind of no-brainer
function similar to Delphi's QuotedStr to achieve that, since it's standard
SQL AFAIK. If not, it would be simple to add it.

Update person set last_name = 'O''Shaunessey'

h.