Re: Special characters --> single quote
| From: | Jason Brooke | Date: | Tue, 22 Aug 2000 15:15:40 +0000 |
| Subject: | Re: Special characters --> single quote | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-12963@lists.php.net to get a copy of this message | ||
It's all I ever do.
But in the event I thought I was also going to be accessing a database from some other language that
didn't have the ability to strip the slashes, I'd probably delimit the single quotes with
another
single quote, using str_replace(). The end result is that your database field is left with the
originally-intended single occurance of the single quotes.
I'm not sure why ludovic decided he'd just go with double quotes instead of the above if
it was so
disturbing to him to use double quotes - particularly when there's no difference between
replacing
all occurances of single quotes with double quotes, or replacing them with 2 single quotes.
I think str_replace() is a pretty quick function, it's not like it's regex.
jason
I'm sure this is a worn out topic here, but this generally seems to be a tricky issue. If you
are
only working within PHP, addslashes(), stripslashes() solves the problem, but when the database must
be shared with other applications, the slashes themselves present a problem. I've been
working
with an AS/400 for years, and this hasn't been an issue because the database is built into the
programming languages, and there isn't any parsing of the data itself. The only time we run
into
this on the AS/400 is when we pull out a .csv file and there are quote on the date. I'm sure
this is
a more general SQL issue, so is this (addslashes/stripslashes) what everyone does in the SQL world?