Do you mean that you can connect to the network, but can't access anything on the internet? If that's the case, it's probably very simple - the school has blocked internet access in the router (or just doesn't have the router connected to any internet connection). That allows a teacher to access all the computers in a classrooom from their computer (as is done in classrooms in which every student sits in front of a computer), it allows emails between those people whose computers or phones are set up for access to the school's email server, etc., but doesn't allow students (and possibly staff members) to access the internet from their phones. (There's no requirement that the school provide you with internet access. And, if you check with "the powers that be" [an IT department, a teacher who knows, etc.] you may find that accessing the internet with your phone by using mobile data isn't allowed either.)
It's most likely not a problem with your phone or with the school's wifi, it's just school policy (at least that you can't access the internet with their wifi). The solution is to do school work when you're in school and access the internet when you're not at school. (This was a hot topic about a decade ago - it even went as far as a few court cases - and it was never found that schools owed students an internet connection.)