From: Chris Payne [mailto:[EMAIL PROTECTED]
> I do have a final question, had a look online but couldn't find
> what I needed. It's hard to explain why, but basically
> individuals have my program on their HD, the DB is on their HD
> etc .... And it connects on startup to a remote server to check
> the latest version number so they can then download if a new
> one is available (Which I package using MS.net's installer
> system for distribution), Anyway, what I want to know is, how
> can I get a NICE error message IF they aren't connected to the
> net when they launch the software on their machine? Currently
> I get a nasty message, but I'd like to replace it with
> something like "Please make sure you are connected to the
> Internet" or something like that? I know the OR DIE command,
> but that doesn't work with connection failures.
I think what you're looking to do is suppress the PHP/DB error and
supply your own. What you want to do is preprend the db connection
function with `@' and add your own upon failure -- something like this:
<?
$dbh = @mysql_connect($dbhost, $dbuser, $dbpass);
if (!$dbh) {
echo "Please make sure you are connected to the Internet";
exit;
}
?>
The only problem with this is that it'll fail with the same error
message if their internet connection is fine but $dbhost is unavailable.
I'm not entirely certain if PHP can gracefully detect a local internet
connection, actually. For your purposes, though, this should do the job.
HTH!
--
Mike Johnson Smarter Living, Inc.
Web Developer www.smarterliving.com
[EMAIL PROTECTED] (617) 886-5539
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php