0

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.

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by metalix
0

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

<?PHP
$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

0

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!!

0

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.