I try to bind parameters to sql (mysqli) in php, but there is an error code as written above. This is the code I wrote:
$stmt = $conn->prepare("INSERT INTO assignments (Classes_has_Subjects_classesHasSubjectsId, assignmentName, gradeForAssignment,protectiveGrade)
VALUES (?, ?, ?, ?)");
if ($stmt = false)
{
echo "false";
}
else{
$stmt->bind_param("sss", $classesHasSubjectsId, $assignmentName, $gradeForAssignment, $protectiveGrade);
$stmt->execute();
}
and here is the error message: 11
Fatal error: Call to a member function bind_param() on boolean in
What's wrong?