adding function addData to database