function addTeacher(Teacher $teacher) { $connectionObject = Connection::getInstance(); $connection = $connectionObject->get_connection(); $name_in_full = $teacher->getName(); $subject = $teacher->getSubject(); $address = $teacher->getAddress(); $telephone = $teacher->getPhoneNumber(); $registered_date = $teacher->getRegisteredDate(); $distance = $teacher->getDistance(); $school_id = $_SESSION['school_id']; $stmt = $connection->prepare("INSERT INTO teacher (name_in_full, subject, address, telephone) VALUES (?,?,?,?)"); $stmt->bind_param("ssss", $name_in_full, $subject, $address, $telephone); $result = $stmt->execute(); $stmt->close(); $teacher_id = mysqli_insert_id($connection); $stmt = $connection->prepare("INSERT INTO teacher_school (teacher_id,school_id,start_of_working_date,distance_from_permanent_residence) VALUES (?,?,?,?)"); $stmt->bind_param("iisi", $teacher_id, $school_id, $registered_date, $distance); $result = $stmt->execute(); $stmt->close(); return $result; }