I'm currently writing a fairly large (hello btw, i'm new here!) program that basically does a shagload of db read/writes with loads of functions.
The problem I am considering is dealing with and displaying error messages. Returning them from each individual function is problematic, and some functions require more than one form of error message.
Another solution is stuffing things in a environment variable such as $_SERVER as an array, but it sweems nasty.
The error messages in question are generally handled mysql errors, but there may be several generated by the program itself.
Basically, how + where do you store a log of whats gone wrong until it can be echoed to the screen?