Is it this line? You're missnig an ' after $jobtitle.
$query = "INSERT INTO users VALUES
('$username','$userpass','$email','$phone','$dept','$jobtitle)";
Ummm, that and it's in the wrong format...
$query = "INSERT INTO users
(name,of,fields,go,here...)
VALUES
('$username','$userpass','$email','$phone','$dept','$jobtitle)";