PART A - updated sql query and fixed the select statements on index.php