I vote for the sql/query option as well. I don't see anything in that code that distinguishes between one user and another, so everyone's value becomes Yes?
Dunno, maybe I need another ?
EDIT - took a look at the attachment. Surely there isn't a db for every student? Respectfully, I think you're short on tables and haven't really designed with the idea of one table representing one entity. Rather it seems that table fields contain a mix of attributes, some of which don't really belong there. If all you want is a solution to your posted question then I guess you have that.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.