For mysql DB it should be ok.
I generally use:
//for storage to database
function prepIn($input) {
$input = trim($input);
if (!get_magic_quotes_gpc()) {
return addslashes($input);
}
return $input;
}
//for o/p to html page, textbox or textarea
function prepOut($output) {
$output = stripslashes($output);
return htmlspecialchars($output);
}
//for multi-line o/p to html page
function prepOutNl($output) {
$output = stripslashes($output);
$output = htmlspecialchars($output);
return nl2br($output);
}
though of course prepIn() assumes that the data comes from get, post or cookie arrays.