Php:Fatal error: call to unrefined function mqsql_real_escape_string ($_POST ['username']);

Php:Fatal error: call to unrefined function mqsql_real_escape_string ($_POST ['username']);

下面的代码和错误给出了

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

 fatal error:call to undefined function mysql_real_escape_string ()

将您的连接字符串从 mysql 更改为 mysqli

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

$Username= mysqli_real_escape_string($link, $_POST['Username']);