function to insert new links into the database