Error Handling
| From: | Michael Schreifels | Date: | Wed, 15 Jun 2005 00:11:28 +0000 |
| Subject: | Error Handling | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-19622@lists.php.net to get a copy of this message | ||
Hello,
I am using PEAR::setErrorHandling() to have PEAR::DB send errors to a
custom error reporting function via the CALLBACK parameter. This is
the function (so far):
function sql_error($error) {
echo "<div style=\"padding: 5px; background: #f3f3f3; border: 1px
inset #000\">\n";
echo "\t<h1 style=\"margin: 0 0 20px 0; color: darkred\">SQL " .
ERROR . "</h1>\n";
echo "\t<p>" . SQL_ERROR_GEN . "</p>\n";
echo "\t<h2>" . ERROR . "</h2>\n";
echo "\t<textarea rows=\"6\" cols=\"30\"
name=\"error\">" .
$error->getMessage() . "</textarea>\n\t<h2>Query</h2>\n";
echo "\t<textarea rows=\"6\" cols=\"30\"
name=\"query\">[QUERY SHOULD
GO HERE]</textarea>\n";
echo "\t<h2>Current URL</h2>\n\t<input type=\"text\"
name=\"url\"
value=\"{$_SERVER['PHP_SELF']}\" />\n";
echo "</div>";
}
The thing is, I want the query to be displayed where I have "[QUERY
SHOULD GO HERE]" so the person using the script knows exactly what
query caused the error. How do I display the query that triggered the
error? I have tried a function that was like getUserInfo() (or
something of that nature), but it also showed the query (which I
display before the query section in the error function).
I would appreciate some assistance. Thanks!
Technel