PDO::quote

Quotes a string for use in a query

PDO::quote places quotes around the input string (if required) and escapes special characters within the input string, using a quoting style appropriate to the underlying driver.