n8w Posted June 2, 2009 Share Posted June 2, 2009 I just want to make sure my data is clean going into the database and legible going out .. would this function work? //in function going_in($text){ $text = trim($text); $text = mysql_real_escape_string($text); $text=htmlentities($text); return $text; } //out function going_out($text){ $text = stripslashes($text); $text = html_entity_decode($text); return $text; } Quote Link to comment https://forums.phpfreaks.com/topic/160586-going-into-the-database-going-out/ Share on other sites More sharing options...
Ken2k7 Posted June 2, 2009 Share Posted June 2, 2009 I have no idea what the usage of htmlentities is in that function. Quote Link to comment https://forums.phpfreaks.com/topic/160586-going-into-the-database-going-out/#findComment-847532 Share on other sites More sharing options...
fenway Posted June 6, 2009 Share Posted June 6, 2009 Define "clean". Quote Link to comment https://forums.phpfreaks.com/topic/160586-going-into-the-database-going-out/#findComment-850499 Share on other sites More sharing options...
n8w Posted September 19, 2009 Author Share Posted September 19, 2009 //in function going_in($text){ $text = trim($text); $text = mysql_real_escape_string($text); return $text; } //out function going_out($text){ $text = stripslashes($text); return $text; } Quote Link to comment https://forums.phpfreaks.com/topic/160586-going-into-the-database-going-out/#findComment-921157 Share on other sites More sharing options...
BioBob Posted September 19, 2009 Share Posted September 19, 2009 could also try looking up htmlspecialchars which will change characters like < and > to their ASCII components like & lt ; or & rt ; or like an ampersand is & amp ; (no spaces) Quote Link to comment https://forums.phpfreaks.com/topic/160586-going-into-the-database-going-out/#findComment-921325 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.