mysqli_real_escape_string http://php.net/manual/en/mysqli.real-escape-string.php
oppure PDO