This is the code which I'm trying to use for the query:
$data=[
  'e_id' => $eid,
  'e_name' => $ename,
  'e_deptid' => $edid,
  'e_sal' => $esal,
];
foreach($data as $keys=>$values){
  if($key==0){
    $fields .= $keys . "=?";
  } else {
    $fields .= ", " . $keys . "=?";
  }
  $key++;
}
$query = "INSERT INTO employee SET $fields";
$stmt = $conn->prepare($query);
$stmt->bind_param(
  "isii", $data['e_id'], $data['e_name'], 
   $data['e_deptid'], $data['e_sal']
);
I am getting the following error:
Fatal error: Uncaught Error: Call to a member function
bind_param()onbooleaninC:\xampp\htdocs\employee\employeesubmit.php:35Stack trace: #0 {main} thrown inC:\xampp\htdocs\employee\employeesubmit.phpon line 35.
what may be the reason for this?
 
    