connect to database and search funtionality