this code should ensure that clean code gets into the database
it should work in earlier versions of PHP (earlier than 4.3.0) and later versions of php (older than 4.3.0)
It works well, because the data gets into the database without problems, but I get an error in the browser
$menu_name = mysql_prep($_POST['menu_name']);
is how i call mysql_prep function
function mysql_prep($value)
{
$get_magic_quotes = get_magic_quotes_gpc();
$new_enough_php = function_exists ("mysql_real_escape_string");
if($new_enough_php)
{
if ($get_magic_quotes)
{
$value = stripslashes ($value);
}
$value = mysql_real_escape_string($value);
}
else
{
if(!$get_magic_quotes)
{
$value = addslashes ($value);
}
}
return $value;
}
source
share