since we dont know where your inputs are coming from, simplest way to check is to do this
<?php
echo "INSERT INTO users (name, group, sex, grouprank) VALUES ('$name', '$group', '$sex', '$grouprank')";
?>
throw the query into SQL manually to see what the error is.
One possibility is that SQL doesn't like variable names. you can try one of these two options to see if it helps (I dont know the reasoning behind it, but i read it somewhere once before )
<?php
$insert = mysql_query("INSERT INTO users (name, group, sex, grouprank) VALUES ('{$name}', '{$group}', '{$sex}', '{$grouprank}')");
$insert = mysql_query("INSERT INTO users (name, group, sex, grouprank) VALUES ('".$name."', '".$group."', '".$sex."', '".$grouprank."')");
?>