How do i remove the / that appears when theres a ' in php.
Very brief but i dont think i can tell you anything else,
Thanks
Jack Dunn
How do i remove the / that appears when theres a ' in php.
Very brief but i dont think i can tell you anything else,
Thanks
Jack Dunn
stripslashes( $str );
?


You may have a deeper issue - the \ is an escape character, and it is there to stop the ' or " or any other "special" character being taken literally. Just removing the \ *may* not be a great idea.
What exactly is it you are trying to do?
You should ask yourself:
* Do i need to use this data in escaped form
* What is escaping the data, and can i stop it happening if i don't need it?
Long time since i've done PHP, but ISTR there being a few php.ini options regarding escaping - anyone refresh my memory?![]()
stripslashes() should do it as always more info on php.net - http://uk2.php.net/manual/en/function.stripslashes.php , but pay attention to what Tom said especially if your dealing with a database as you may be opening yourself up to SQL injection attack.
Cheers
Jona

The normal way of handling escaping is to allow the data to be be stored with the slashes in place and only remove them when outputting on screen.
Just as a note on that... One trick that often works is to do a preg_replace() on any input and replace ' with '' (that's two single quotes btw!) which will stop any injection routines and is the same as an escaped ' in MySQL.
For more info' this ref is quite useful.
http://dev.mysql.com/doc/refman/5.0/...ng-syntax.html
There are several ways to include quote characters within a string:
*
A “'” inside a string quoted with “'” may be written as “''”.
*
A “"” inside a string quoted with “"” may be written as “""”.
*
Precede the quote character by an escape character (“\”).
*
A “'” inside a string quoted with “"” needs no special treatment and need not be doubled or escaped. In the same way, “"” inside a string quoted with “'” needs no special treatment.
There are currently 1 users browsing this thread. (0 members and 1 guests)