with calls specific to the appdb or bugzilla database. Fixes a bug where a call to
mysql_insert_id() can potentially retrieve an id from either the bugzilla or appdb database,
depending on whichever database was last opened by mysql_connect().
then the db insertion will fail and result in a call to query_error(). Once we've entered query_error() once if we enter it
again we should simply return
let us more easily debug difficult or intermittent issues that users may not report. Add a cron to report logged
errors to appdb admins every night. Implement some basic unit tests for the new error logging code