duglus
answered Jul 27 '21 00:00
you should pass mysqli object to mysqli_escape_string .
syntax
mysqli_real_escape_string(mysqli $mysql, string $string): string
you need to pass two-argument mysqli object and string value as second argument.
so in your code , following change required :
$empname='Emp 1';
$insert="insert into employee ('name') values('".mysqli_escape_string($connection,$empname)."')";
mysqli_query($connection,$insert)