fetching data from database working properly