|
Script PHP that formats a chain to be introduced in a database, to make sure that does not spoil a judgment SQL. How many times have you been frightened that a chain that you are going to introduce in a field of a table does not have the correct format, and have checked it, and checked again... and then you discover that it has given an error on having introduced it because there were not valid characters?
Since you can already breathe with mitigation because with the script that we provide your headaches to you they have the few days:
function str_asegurar ($cadena) {
//I eliminate tags HTML and PHP
$cadena = strip_tags ($cadena);
//I eliminate the character quotation mark, which can spoil a judgment
$cadena = str_replace ("'", "'", $cadena);
return $cadena;
}
After having executed the script, only it stays to realize the insertion judgment.
Miguel Angel Alvarez
http://www.desarrolloweb.com/articulos/1440.php?manual=6 |