in reply to Updating database question

You have a lot of options above for handling this in code, but personally I would suggest you handle it directly in the database.

I don't know what columns $row[3] and $row[4] represent, but your code is doing a mapping between the two, so create a table to hold the pairs. Something like:

create table curtisb_map ( row3_code varchar(20) -- pure guess , row4_code varchar(20) -- purer guess , primary key (row3_code, row4_code) );
Then populate the table with your if-else data above, and you can just return both with a single select:
select s.*, m.row_3_code from staging.staging_prepouics s inner join curtisb_map m on m.row3_code = s.whatever

The advantage with this approach is that the data is in the database where it belongs, instead of half in the database and half in the code. The next maintenance programmer that comes along will thank you profusely when she finds the mapping right alongside the data. And the bonus is that this is likely to run much faster.

As an aside, your code has something that makes me cringe every time I see it: select * is bad enough, but it's made worse by the assumption of column order (i.e., you're hoping that $row[3] and $row[4] are what you think they are). Do yourself a favor, call out the column names explicitly, and bind the results to meaningful variables. Sooner or later, this practice will bite you.