I am using the function below to escape my string before it is inserted into the DB. Though it actually inserts the double apostrophe into the database, and when I print it out it still has the double apostrophe. What is the right way to print the value out with the original single apostrophe?
function mssql_escape($var){
if(get_magic_quotes_gpc()){
$var = stripslashes($var);
}
return str_replace("'", "''", $var);
}