-2

below code and the error has given

$Username =mysql_real_escape_string ($_POST['Username']);

 fatal error:call to undefined function mysql_real_escape_string ()
NIMISHAN
  • 1,265
  • 4
  • 20
  • 29
Raj Raj
  • 3
  • 1
  • Don't use the `mysql_*` functions. They have been deprecated since v5.5 (Jun 2013) and removed since v7.0 (Dec 2015). Instead use [**mysqli**](https://secure.php.net/manual/en/book.mysqli.php) or [**PDO**](https://secure.php.net/manual/en/book.pdo.php) functions with [**prepared statements**](https://secure.php.net/manual/en/pdo.prepare.php) and [**bound parameters**](https://secure.php.net/manual/en/pdostatement.bindparam.php). – Alex Howansky Oct 07 '18 at 15:19
  • What is your current php version and your mysql connection string ? – Sachin Oct 07 '18 at 15:19

1 Answers1

1

Change your connection string from mysql to mysqli

 // connection string
 $link = mysqli_connect("localhost", "username", "mpassword", "database") or die($link);

$Username= mysqli_real_escape_string($link, $_POST['Username']);
Sachin
  • 789
  • 5
  • 18