Re: [PHP] Using PHP with MySQL - Can I supress MySQL errors?

2002-07-23 Thread Tim Fountain


On Tuesday, July 23, 2002, DonPro wrote:

 I've noticed that it there is an error performing certain commands
 like 'mysql_connect()'

 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.

Assuming I understand you correctly, to surpress errors from PHP
functions simply put an '@' symbol before the function.  This will
surpress the error message from PHP but will still execute your 'or'
statement, storing the message in your array, e.g.:

$result = @mysql_connect('blah','blah','blah') or
some_error_function();

or I guess you could also do:

$result = @mysql_connect('blah','blah','blah');
if (!$result)
{
   $error_array[] = mysql_error();
   ...
}

-- 
Tim Fountain ([EMAIL PROTECTED])
http://www.tfountain.co.uk/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Using PHP with MySQL - Can I supress MySQL errors?

2002-07-23 Thread Martin Clifford

Put an ampersat symbol (@) in front of the function name to suppress errors.

$link = @mysql_connect(host, user, pass);

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 DonPro [EMAIL PROTECTED] 07/23/02 12:08PM 
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?

Thanks,
Don



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php