Skip to content

mysql_escape_string

imshooter edited this page Nov 29, 2026 · 1 revision

Escape a string for a string literal.

native mysql_escape_string(
    const source[],
    destination[],
    max_len = sizeof (destination),
    MySQL:handle = MYSQL_DEFAULT_HANDLE
);

With open.mp names, from the same include:

native MySQL_EscapeString(
    const source[],
    destination[],
    max_len = sizeof (destination),
    MySQL:handle = MYSQL_DEFAULT_HANDLE
);

Parameters

Parameter Description
const source[] The string.
destination[] Array for the escaped string.
max_len = sizeof (destination) Size of the array.
MySQL:handle = MYSQL_DEFAULT_HANDLE Handle whose escaping is used.

Returns

  • The length of the escaped string.
  • 0 when it does not fit, and the array is left empty, or the handle does not exist.

Home

Guides

Reference

Functions

Connections
Queries
Cache
JSON cells
ORM
Queries built in pieces
Prepared statements
Batches
Transactions
Passwords
Callbacks

Clone this wiki locally