What is the use of mysql_real_escape_string() function?
What is the use of mysql_real_escape_string() function?
Share
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Aviance School is one of the largest web solutions platform in India for developers to learn and share their programming knowledge and build their careers.
mysql_real_escape_string() Escapes special characters in a string for use in an SQL statement otherwise an error like
E_WARNING
is generated.Sample example
<?php
//MySQL connection
includes("config.php");
$username= "bikash's";
$uname= mysql_real_escape_string($username);
$query = "SELECT * FROM user_master WHERE user_name = '$uname'";
var_dump($uname);
var_dump($query);
?>