Add local $resultSet and fix mysqli query