-1
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

  • Does this answer your question? [Uncaught Error: Call to undefined function mysql\_escape\_string()](https://stackoverflow.com/questions/34614096/uncaught-error-call-to-undefined-function-mysql-escape-string) – ADyson Nov 22 '21 at 22:10

2 Answers2

1

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.

Lka
  • 394
  • 1
  • 7
0

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

MaggsWeb
  • 3,018
  • 1
  • 13
  • 23