Converted Python code for database handling to general setup
Made the generic PHP code compatible with the database