database access working on index page