in reply to Can not figure out cause of error.

fetchrow_array() only fetches one row. If your result set has more than one row, you need to either fetch them all (e.g. in a loop), or else use $sth->finish after the fetch and before disconnect.