|
mysqli::real_escape_stringmysqli_real_escape_stringEscapes special characters in a string for use in an SQL statement, taking into account the current charset of the connection DescriptionObject-oriented style
public string mysqli::real_escape_string(string
$string )Procedural style string mysqli_real_escape_string(mysqli
$mysql , string $string )This function is used to create a legal SQL string that you can use in an SQL statement. The given string is encoded to produce an escaped SQL string, taking into account the current character set of the connection. Caution
Security: the default character setThe character set must be set either at the server level, or with the API function mysqli_set_charset for it to affect mysqli_real_escape_string. See the concepts section on character sets for more information. Parameters
Return ValuesReturns an escaped string. ExamplesExample #1 mysqli::real_escape_string example Object-oriented style
Procedural style
The above examples will output something similar to: Select returned 1 rows. Fatal error: Uncaught mysqli_sql_exception: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's-Hertogenbosch'' at line 1 in... See Also
|