note 91016 deleted from language.operators.errorcontrol by danbrown
| From: | danbrown@php.net | Date: | Thu, 21 May 2009 12:51:23 +0000 |
| Subject: | note 91016 deleted from language.operators.errorcontrol by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-155837@lists.php.net to get a copy of this message | ||
Note Submitter: wbeaumo1 AT gmail DOT com
----
RE: gerrywastaken
As you probably know, there are some error-causing conditions that you just can't test for. For
instance, mysql_connect() outputs an error if an attempt to connect to a MySQL database fails. How
can you test for the condition that typically causes this, i.e., incorrect username and/or password?
The only way to know if the username and password are incorrect is to "ask" the database
by trying to connect to it, and if they're incorrect, some output will be generated that you
may not want. You may feel confident that the username and password supplied are correct because
they've always worked as long as they've been constant in the code. But what if the
password was recently changed in the database? Hence, error suppression is the way to go in such
situations.