Web Hosting - Debt Consolidation - Wordpress Themes - Find jobs - Become hacker

PDA

View Full Version : HELP! how to remove / in apostrophe


buknoii
Nov 9th 2008, 5:19 pm
hi there! i want to ask if someone in here got an idea on how to remove the \ in apostrophes?

because everytime i access content in my database and if it has ' it also displays \

for example cricket\'s should be crickets

keiths
Nov 9th 2008, 5:34 pm
You can use the function stripslashes - http://us2.php.net/stripslashes

Use it like this:


<?php
$var = "cricket\'s";
$var = stripslashes($var);
echo $var;
?>

garrettheel
Nov 9th 2008, 6:22 pm
The reason it does it is to sanitize user input to stop anybody executing their own code on your database. Just use stripslashes() on all output like the person above me said.