This is my PHP code:
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$UpdateChecklist = 'UPDATE checklists SET ADMIN_ID=?, COMPUTER_ID=? WHERE id=?';
$stmtChecklist = $connection->prepare($UpdateChecklist);
$stmtChecklist->bind_param('ii', $_POST['ADMIN_ID'], $_POST['COMPUTER_ID']);
$isUpdate = $stmtChecklist->execute();
$lastUpdateId = mysqli_insert_id($connection);
$stmtChecklist->close();
$UpdateInstalledProgram = 'UPDATE checklist_programs SET CHECKLIST_ID=?, PROGRAM_ID=? WHERE id = ?';
$stmtProgramId = $connection->prepare($UpdateInstalledProgram);
$stmtProgramId->bind_param('ii', $lastUpdateId, $programId);
foreach ($_POST['PROGRAM_ID'] as $program) {
$programId = $program;
$stmtProgramId->execute();
}
$connection->close();
if ($isUpdate) {
header('Location: OverViewCheckList.php');
exit(0);
}
}
?>
and, I got some error which I don't know how to fix it:
Warning: mysqli_stmt::bind_param(): Number of variables doesn't match number of parameters in prepared statement in C:\xampp\htdocs\checklist\updateChecklist.php on line 34
Warning: mysqli_stmt::bind_param(): Number of variables doesn't match number of parameters in prepared statement in C:\xampp\htdocs\checklist\updateChecklist.php on line 44
Warning: mysqli::query(): Couldn't fetch mysqli in C:\xampp\htdocs\checklist\updateChecklist.php on line 57
Fatal error: Call to a member function fetch_assoc() on null in C:\xampp\htdocs\checklist\updateChecklist.php on line 59