the return statement is needed to be after database connection which is wrongly put in up now corrected