PhP and SQL scripts for database and backend

Needs some work, but here it is!
PhP and SQL edited for study page