escaping characters
I have a simple but perplexing problem I could use some help with.
I am storing user text input strings in mysql, and am escaping ' and
" with addslashes.
When I pull them out and use stripslashes, I sometimes get errors
because I don't know if they have a ' or a " in the string.
Example 1
String is: I'm cool
This works: echo "I'm cool";
This does not: echo 'I'm cool';
Example 2
String is: You are "cool"
This works: echo 'You are "cool"';
This does not: echo "You are "cool"";
Example 3
String is: I'm "cool"
This does not work: echo "I'm "cool"";
This does not work: echo 'I'm "cool"';
So, how do I output strings of unknown content?
Thanks for any guidance.
Steve
[PHP Home]
[PHP Users]
[PHP Soap]
[Kernel Newbies]
[Yosemite]
[Yosemite Campsites]