Hello all,
well sometimes user insert information like "name" in the database because of which it causes problem in the site. So anyone tell me how to resolve this problem. I have already used addslashes.

8 Years
Discussion Span
Last Post by metalix

addslashes simply puts a slash before it.
what you need to do is when echoing to the browser convert those symbols to html

$var = 'this\'s some "users content"'
$var = str_replace('"','"', $var);
$var = str_replace("'", ''', $var);

I created a very short tutorial (pretty much just a code reference) at my site

Edited by metalix: n/a


hey this I have already tried it works for 1st time or sometime site doesn't open properly and when u edit it again it won't display. I am so sick and tired of this problem. plz give me some long lasting solution if anyone knows. Anyways thanx metalix but this don't work!!


oh sorry I just looked at it and didn't realise daniweb wasn't set up to handle html code references.
I attached a file with the char list. view that tutorial for more details.
you can also use the hex (hx) for example where space is 20, use %20

Attachments reference.jpg 470 KB
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.