Or you could write an error handler (set with set_error_handler) which is executed on any warning, error or notice - and make that log everything. Be sure to have error_reporting(E_ALL) on.
To further avoid reinventing the wheel, you could use PHP's error_log() - which logs to wherever it's configured to do.
Then you have to learn to stop using the @ operator anywhere - but at least, you don't ever have to check the result of mysql_query, as if it fails it will kick your error logger in automatically.
This approach has the advantage that it will also detect any non-MySQL errors, and it requires the minimum of code (i.e. NO error checking code on a per-call basis).
It's what we use throughout.
Mark