In my free time I also love to contribute my tech knowledge to the world, So I have created this blog and sharing my knowledge with others.
Don't wanna be here? Send us removal request.
Link
How to escape single quotes in MySQL
This function is used to create a legal SQL string that you can use in an SQL statement. The given string is encoded to an escaped SQL string, taking into account the current character set of the connection.
mysqli_real_escape_string(connection,string);
mysqli::real_escape_string
mysqli::escape_string
mysqli_real_escape_string
Escapes special characters in a string for use in an SQL statement, taking into account the current charset of the connectionDescription
Object oriented style
string mysqli::escape_string ( string $escapestr )
string mysqli::real_escape_string ( string $escapestr )
Procedural style
string mysqli_real_escape_string ( mysqli $link , string $escapestr )Parameters
link
Procedural style only: A link identifier returned by mysqli_connect() or mysqli_init()
escapestr
The string to be escaped.Characters encoded are NUL (ASCII 0), \n, \r, \, ', ", and Control-Z.
Return Values
Returns an escaped string.
Errors/ExceptionsExecuting this function without a valid MySQLi connection passed in will return NULL and emit E_WARNING level errors.
0 notes