Re: Using PHP with MySQL - Can I supress MySQL errors?
| From: | Richard Lynch | Date: | Wed, 24 Jul 2002 03:11:00 +0000 |
| Subject: | Re: Using PHP with MySQL - Can I supress MySQL errors? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-109229@lists.php.net to get a copy of this message | ||
>Hi,
>
>I'm using PHP to connect and perform queries with a MySQL database. I've
>noticed that it there is an error performing certain
>commands like 'mysql_connect()', I'll get a warning message in the browser.
>
>I'd like to suppress these messages as I am storing the error,
>mysql_error(), in an array. So if there is an error, I would simply
>display the contents of the array in a nice format.
>
>Is this possible?
<?php
$connection = @mysql_connect(...) or $errors[] = mysql_error();
?>
The @ symbol will suppress *ALL* error messages. Even if you screw up and
type myslq_connect or something equally bone-headed. Be aware of that.
Code first without the @'s, and then sprinkle them in as needed. :-)
--
Like Music? http://l-i-e.com/artists.htm
I'm looking for a PRO QUALITY two-input sound card supported by Linux (any
major distro). Need to record live events (mixed already) to stereo
CD-quality. Soundcard Recommendations?
Software to handle the recording? Don't need fancy mixer stuff. Zero (0)
post-production time. Just raw PCM/WAV/AIFF 16+ bit, 44.1KHz, Stereo
audio-to-disk.