NYCPHP Meetup

NYPHP.org

[nycphp-talk] mysql_connect() doesn't affect mysql_error()?

George Webb gw.nyphp at gwprogramming.com
Thu Aug 14 17:48:32 EDT 2003


Hi.  I am calling @mysql_connect(...) with the leading '@' in order
to suppress the error messages.  But then if the connect fails, I
want to capture the exact error string of why the connect failed.
(I.e. send it to the admin, rather than to the user.)

	However, it seems that mysql_error() returns empty
after a failed mysql_connect()!  Is this normal?  Has it always
been this way?  I am using PHP 4.3.2.

	Is the only solution, then, to get rid of the leading '@' and
use the output buffering functions to grab the error message?  That
seems ugly.  Is there another way to re-route the error message after
mysql_connect()?

	Thanks!


Sincerely, George.

George Webb
gw.nyphp at gwprogramming.com



More information about the talk mailing list