You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'group, password, email) VALUES ( NULL, NULL, NULL, ' at line 2
$result2 = "
INSERT INTO register
(id, family_name, first_name, middle_name, year, faculty, direction, group, password, email)
VALUES
( NULL, NULL, NULL, NULL, '$year', '$faculty', '$direction', '$group', NULL, NULL)";