Re: How to suppress error messages when using 'new mysqli(...)'
| From: | Richard Lynch | Date: | Fri, 05 Jan 2007 21:47:30 +0000 |
| Subject: | Re: How to suppress error messages when using 'new mysqli(...)' | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-246631@lists.php.net to get a copy of this message | ||
On Fri, January 5, 2007 12:29 pm, Richard Morris wrote:
> I am having this problem that I hope can be worked around. I make a
> connection to our MySQL database using the object version of mysqli.
> If
> access is denied because of an incorrect username or password, mysqli
> displays an error. Is there any way to suppress the error message?
To suppress a single error message in a single line you can use the @
operator in PHP:
@this_code_errors_but_youll_never_see_the_error(...);
To catch errors in a more general manner:
http://php.net/set_error_handler
Also, since mysqli is new-fangled, it's probably using that fancy
try/catch/throw stuff, so you could PROBABLY wrap it in a try/catch
block and that will somehow magically suppress the error message,
maybe... I really don't know (or want to know) much about this, but
you're welcome to research it and find out.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?