PHP mysqli_real_escape_string() Function
Escape special characters in a string:
Definition and Usage
The mysqli_real_escape_string() function escapes special characters in a string used in an SQL statement.
Syntax
mysqli_real_escape_string(
connection,escapestring
)
;
| Parameters | Description |
|---|---|
| connection | Required. Specifies the MySQL connection to use. |
| escapestring | Required. The string to escape. The characters encoded are NUL (ASCII 0), \n, \r, \, ', " and Control-Z. |
Technical Details
| Return Value: | Returns the escaped string. |
|---|---|
| PHP Version: | 5+ |
PHP MySQLi Reference Manual