in reply to Re: Looping through a subrouting
in thread Looping through a subrouting

It would seem that the function can't "see" $dbh. Did you create $dbh using my? If so, $dbh is out of scope. You'll need to pass it to the function as well along with $id.