updated database select queries, added insert queries, placed each part into different separate php files