View Full Version : htmlspecialchars and so on..

11-28-2010, 09:54 AM
Hey guys,

Just a simple question maybe. I'm using a news system on my website which I've made myself, but the news does not enter into the database when using any special character like below:

~ or ` or ' or "

I've tried using the following but it still does not work:

$news = htmlspecialchars(htmlentities(stripslashes(trim($_POST['news']))));

Anyone knows the right way to use this so I can still use the "special characters"? :P

Thanks in advance!

11-28-2010, 10:09 AM
Assuming MySQL, mysql_real_escape_string().

11-28-2010, 11:27 AM
Thanks, that worked :)