new func: register to database