<?php
$stmt = $conn->prepare("INSERT INTO assignments (Classes_has_Subjects_classesHasSubjectsId, assignmentName, gradeForAssignment,protectiveGrade)
VALUES (?, ?, ?, ?)");
if (!$stmt) {
echo "false";
}
else {
$stmt->bind_param("ssss", $classesHasSubjectsId, $assignmentName, $gradeForAssignment, $protectiveGrade);
$stmt->execute();
}
if ($stmt = false) means you're assigning false to $stmt. Replace it with if (!$stmt).
You're binding 4 parameters but only providing 3 types of values. I added a s in the bind_param function, assuming all your values are string. If some of the values are integers replace the corresponding s with an i. If there are doubles, replace with a d.
Are you sure the first field's name in the assignments table is Classes_has_Subjects_classesHasSubjectsId?