I have written this short function to protect against my_sql injection, because of its importance I just want to double check with other\'s that this will function as I inte
If you use PDO (properly) you don't have to worry about MySQL injection.
Sample:
/* Execute a prepared statement by passing an array of insert values */
$calories = 150;
$colour = 'red';
$sth = $dbh->prepare('SELECT name, colour, calories
FROM fruit
WHERE calories < :calories AND colour = :colour');
$sth->execute(array(':calories' => $calories, ':colour' => $colour));
More information