You don't need to store the words in the database. Just create a function. Put this piece of code in your php page anywhere BEFORE you get the message.
function censor($message) {
$badwords = array('shit','hell','die','death');
foreach ($badwords as $badwords) {
$message = str_replace($badwords, '', $message);
}
return $message;
}
And after you grab the message from wherever, call the function before displaying it.
$message = "Hello shit oh shit what the hell this is shit day";
$message = censor($message);
echo $message;