Jump to content

[SOLVED] replace ampersand before gets to DB


madcrazy1

Recommended Posts

hi,

how can i replace the ampersand with & before it gets stored in the database.

i have an existing function the actually strips the script tags, can something be added to this bit of code to get this accomplished?

 

<?php
function escape_string($string) {
    return  get_magic_quotes_gpc()?mysql_real_escape_string(stripslashes($string)):mysql_real_escape_string($string);
}

function html2txt($document){
$search = array('@<script[^>]*?>.*?</script>@si');
               
$text = preg_replace($search, '', $document);
return $text;
}
?> 

 

thank you

<?php
function escape_string($string) {
    return  get_magic_quotes_gpc()
?mysql_real_escape_string(stripslashes($string)):mysql_real_escape_string($string)
:str_replace('&','&',$string);
}

function html2txt($document){
$search = array('@<script[^>]*?>.*?</script>@si');
               
$text = preg_replace($search, '', $document);
return $text;
}
?> 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.