mysql_real_escape_string in php – mysql_real_escape_string example

mysql_real_escape_string in php, The mysqli_real_escape_string() function is an inbuilt function in PHP Example.

PHP mysqli real_escape_string() Function

The mysql_real_escape_string() function escapes special characters in a string for use in an SQL statement.

The following characters are affected:

  • \x00
  • \n
  • \r
  • \
  • \x1a

mysql_real_escape_string in php

function retriveTxtVal($key)
{
    $value = (isset($_REQUEST[$key])) ? $_REQUEST[$key] : "";
    return mysql_real_escape_string(trim($value));
}

Example #1 Simple mysql_real_escape_string() example


mysqli real escape string php


Don't Miss : PHP MySQLi Advance Live Searching

An example SQL Injection Attack


SELECT * FROM members WHERE member='admin' AND password='' OR ''=''

I hope you get an idea about mysql_real_escape_string in php.
I would like to have feedback on my infinityknow.com.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment