I have a snippet of code as follows:
$sql = "INSERT INTO tasks
(task_name, description, due_date, state, userID, importID)
VALUES (?, ?, ?, ?, ?, ?)";
$stmt = mysqli_stmt_init($conn);
mysqli_stmt_bind_param($stmt, "sssiss", $name, $description, $due, 0, $_SESSION['userID'], $id);
When run in the browser, the browser does not load and a try catch statement does not work so I am not able to identify the exact error. I have an almost identical bit of code which works perfectly. The only difference is that this bit of code is in a for each loop. Will that have something to do with it?
EDIT: I forgot to mention all of this is in an if statement to prepare the statement.
if (!mysqli_stmt_prepare($stmt, $sql)) {
header("Location: ../import.php?error=sqlinserterror");
exit();
} else {
mysqli_stmt_bind_param($stmt, "sssiss", $name, $description, $due, 0, $_SESSION['userID'], $id);