note 20865 modified in function.ociparse by maxim
| From: | maxim@php.net | Date: | Tue, 06 Aug 2002 03:45:16 +0000 |
| Subject: | note 20865 modified in function.ociparse by maxim | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-34375@lists.php.net to get a copy of this message | ||
If you've got an SQL statement with apostrophes, for example, insert into table values
('dave's comments')...
Then you need to escape apostrophes when using Oracle 8. This is done with another apostrophe, and
not a backslash.
So, if your environment variables come default with backslashs, you can remove them with: $my_var =
stripslashes($my_var);
Then, to replace all occurances of single apostrophes with double apostrophes, use: $my_var =
str_replace("'","''",$my_var);
If the above mixture of double and single apostrophes is too hard to read... it's a single
apostrophe within double apostrophes, and then two single apostrophes within double apostrophes.
--was--
If you've got an SQL statement with apostrophes, for example, insert into table values
('dave's comments')...
Then you need to escape apostrophes when using Oracle 8. This is done with another apostrophe, and
not a backslash.
So, if your environment variables come default with backslashs, you can remove them with: $my_var =
stripslashes($my_var);
Then, to replace all occurances of single apostrophes with double apostrophes, use: $my_var =
ereg_replace("'","''",$my_var);
If the above mixture of double and single apostrophes is too hard to read... it's a single
apostrophe within double apostrophes, and then two single apostrophes within double apostrophes.
http://www.php.net/manual/en/function.ociparse.php