I need to escape array's, I am using array_map
with mysqli_real_escape_string
.
I have multiple arrays like
$_post['countries'];
$_post['categories'];
.
.
How do I perform escaping on these arrays
I am doing this way
$countries=array_map('mysqli_real_escape_string', $_POST['countries']);
$categories=array_map('mysqli_real_escape_string', $_POST['categories']);
.
.
but it shows me error as Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given in
also doing
$categories=mysqli_real_escape_string($connection, $_POST['categories']);
gives error as
Warning: mysqli_real_escape_string() expects parameter 2 to be string, array given in
Please see and suggest a way or another better way to do this.
Thanks