in reply to A question of style.

If this is exactly the code you're dealing with, then some of the if's can be removed:

The other three levels are necessary, since you're testing three different conditions: the value of $action, the location, and the elements of @built (well, unless you're willing to start calling DIE to abort the flow).

I'd suggest that you use separate variables for the queries though, rather than recycling $sth all the time. Then (as well as being more readable), they can be pre-prepared, using placeholders.

--
Tommy
Too stupid to live.
Too stubborn to die.