Home > Back-end >  Uncaught Error: Call to undefined function mysql_real_escape_string() in .... on line 7
Uncaught Error: Call to undefined function mysql_real_escape_string() in .... on line 7

Time:11-23

include "db.php";

extract($_POST);

$fname = str_replace("'","`",$fname); 
$fname = mysql_real_escape_string($fname); <----

$lname = str_replace("'","`",$lname); 
$lname = mysql_real_escape_string($lname); 

Is about a registration form for a forum

CodePudding user response:

All mysql_* functions stoped working since PHP7.0, try using mysqli_* function like : mysqli_real_escape_string.

Don't forget to change your mysql_connect to mysqli_connect.

CodePudding user response:

Further to Lka’s message, mysqli_real_escape_string also takes the $db connection as the first parameter.

  • Related