mysql_escape_string($variabile);

http://it.php.net/mysql_escape_string