I have an error like this in my code
Fatal error: Uncaught Error: Call to undefined function mysql_real_escape_string() in C:\xampp\htdocs\wp\server.php:12 Stack trace: #0 C:\xampp\htdocs\wp\register.php(1): include() #1 {main} thrown in C:\xampp\htdocs\wp\server.php on line 12
My code is
$username="";
$email="";
$errors=array();
//conct to sever
$db = mysqli_connect('localhost','registration');
//register button click
if (isset($_POST['register'])){
$username=mysql_real_escape_string($conn,$_POST['username']);
$email=mysql_real_escape_string($conn,$_POST['email']);
$password_1=mysql_real_escape_string($_POST['password_1']);
$password_2=mysql_real_escape_string($_POST['password_2']);
Can someone explain What is the function of mysql_real_escape_string() in php?