I am trying to array_map to sanitize an array, which I have created from a csv file. Here's my code:
if (isset($_FILES['csv']['size'])) {
    if ($_FILES['csv']['size'] > 0 && $_FILES['csv']['size'] != NULL  ) { 
        //Clear existing qty_csv table
        mysqli_query($conn,'TRUNCATE TABLE qty_csv');
        $row_count  = 0;
        //get the csv file 
        $filename = $_FILES['csv']['tmp_name']; 
        $handle = fopen($filename,"r"); 
        $delimiter = ',';
    $unescapedArray = array();
        $data = csv_to_array($filename,$delimiter);
function array_map_callback($a)
{
  global $conn;
  return mysqli_real_escape_string($conn, $a);
}
$data2 = array_map('array_map_callback',$data);
Whenever I run my bit of code I get the warning:
Warning: mysqli_real_escape_string() expects parameter 2 to be string, array given in C:\xampp\htdocs\
Why does this happen, and how can I fix it?
This is the structure of the original data:
part_code varchar(20)
part_descr varchar(255)
part_location varchar(20)
part_qty_in_stock int(11)
reorder_level int(11)
reorder_qty int(11)
part_price decimal(6,2)
 
     
    