errorhandler problems with mssql
| From: | Bryan Kaufman | Date: | Wed, 05 Sep 2001 17:13:40 +0000 |
| Subject: | errorhandler problems with mssql | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-9201@lists.php.net to get a copy of this message | ||
I am having a problem with my custom errorhandler
"ignoring" the exit (or die) inside the handler.
I have experienced it with several mssql_* functions.
php 4.0.6 and php 4.0.7 running in cgi mode on iis 5
Try the code below:
using an invalid servername, it behaves properly
(returns an error). But if you have a valid
servername, and invalid username/password the script
never finishes. The browser will time out.
This also happens if you have a valid
servername/username/password, but invalid db name.
Or of you can connect, but pass an invalid query. (not
in this code snippet) Can anyone else reproduce this
problem? Am I doing something wrong? It makes using
a custom error handler useless...
<?php
$old_error_handler = set_error_handler("myEH");
$db_hostname = "servername";
$db_username = "username";
$db_password = "password";
$db_dbname = "dbname";
MSSQL_CONNECT($db_hostname,$db_username,$db_password)
;
mssql_select_db($db_dbname);
echo "Logged in OK!";
function myEH($errno, $errstr, $errfile, $errline,
$context) {
if ($errno<8) {
echo 'Sorry, there was an error.';
exit();
}
}
?>
Thanks for any insight!
Bryan
__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com