also, i'm not sure if i'm understanding your code correctly... but..
$query = mysql_query("SELECT ID FROM $_SESSION[admin_module] where ldgroup= '$rez[ldgroup]' ");
you'll need to put $rez[ldgroup] in {} for it to give the variable
$query = mysql_query("SELECT ID FROM $_SESSION[admin_module] where ldgroup= '{$rez[ldgroup]}' ");
and.. i dont know if you can store or compare arrays in SQL. when you print $rez it should give you "Array"...so if you try to do:
SELECT * FROM stud where ID LIKE '%$rezb%'
It will be searching for the text "Array". You'll need to put an actual variable in there instead of referencing the entire array.