How can I find user role based on user id?
Use user_load() or global $user.

global $user;
$account = $user;
$role = $account-&gt;roles;// returns user role.


or

$user = user_load(uid);
$role = $user-&gt;roles;//return user role