Perhaps it would be easier to use bind variables instead. For example,
$empno = 1234;
$ename = "O'Reilly";
$conn = OCILogon('scott', 'tiger');
$sql = 'INSERT INTO emp (empno, ename) VALUES (:empno, :ename)';
$stmt = OCIParse($conn, $sql);
OCIBindByName(':empno', $empno, -1);
OCIBindByName(':ename', $ename, -1);
OCIExecute($stmt);
Check out Thies' presentation:
http://conf.php.net/pres/index.php?p=slides%2Foci&id=oci2
If you have questions, let us know.
-Anthony
> From: "Ford, Mike [LSS]" <[EMAIL PROTECTED]>
> Date: Wed, 16 Oct 2002 12:14:58 +0100
> To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] Oracle problem
>
>> -----Original Message-----
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
>> Sent: 16 October 2002 08:51
>> To: [EMAIL PROTECTED]
>>
>> Has anyone out there using PHP and Oracle come across this
>> problem? I have
>> a text area that allows free-form text that I store in a
>> varchar2 column. I
>> have problems with apostrophes in the free-form text.
>
> Uh-oh! Standard can of worms no. 3!
>
>> When
>> users put in an
>> apostrophe the SQL fails. If I force 3 apostrophes (the
>
> Shouldn't that be *two* apostrophes? That's how it works here, anyway!
>
>> usual Oracle method
>> of embedding apostrophes) the SQL fails. The only way to get
>> round the
>> problem is to strip them out (which I consider a work-around
>> not a fix).
>
> You may also want to investigate the php.ini settings magic_quotes_gpc,
> magic_quotes_runtime and magic_quotes_sybase -- although personally I prefer
> not to use these as I'm averse to magic (well, other people's, anyway!).
>
> Cheers!
>
> Mike
>
> ---------------------------------------------------------------------
> Mike Ford, Electronic Information Services Adviser,
> Learning Support Services, Learning & Information Services,
> JG125, James Graham Building, Leeds Metropolitan University,
> Beckett Park, LEEDS, LS6 3QS, United Kingdom
> Email: [EMAIL PROTECTED]
> Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php