If I understand well, then you should filter for (i.e.) the login_name to get type of the user:
$typequery = mysql_query("SELECT type FROM $table WHERE login_name='$_POST[loginName]");
Don't forget fetching the row from the $typequery - it's only a resource! (see http://php.net/mysql_query)
When you get the type you can compare it with a simple '==' operator, as @abbiya said.
Finally, php mysql library is deprecated, your code is very vulnerable - see this: Why shouldn't I use mysql_* functions in PHP?