"; $query = 'SELECT mdl_user_students.userid FROM `mdl_user_students` WHERE course = "15"'; $res = mysql_query($query); echo "Got Users
"; echo $res; while(list($userid) = mysql_fetch_row($res)) { $ids[] = $userid; } echo "Processing User IDs
"; foreach($ids as $uid) { // $query = "INSERT INTO mdl_forum_subscriptions (userid, forum) VALUES($uid, 1)"; // mysql_query($query); // echo $query . '
'; $query = "UPDATE mdl_message_access_users SET level=0 WHERE user = $uid"; mysql_query($query); echo $query . '
'; } ?>