PHP – Clean String for DB Entry

This PHP function helps you to clean a string while save into database.

Code Example:

<?php
function clean_for_db($data) {
    $entry = trim($data);
    $entry = strip_tags($entry);
    $entry = mysql_real_escape_string($entry);
    return $entry;
}
?>

Post to Twitter Post to Digg Post to Facebook Post to Google Buzz Send Gmail