RE: [PHP] Why is this needed??
| From: | Jennifer Goodie | Date: | Tue, 13 May 2003 00:06:17 +0000 |
| Subject: | RE: [PHP] Why is this needed?? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-147376@lists.php.net to get a copy of this message | ||
> $dbl = @mysql_connect($dbms_hn, $dbms_un, $dbms_pw);
>
> I tried the '@' in my code and BANG! it worked. I was able to
> connect. What does the '@' do for you???
The @ did not fix the problem, it merely hid it. The @ operator is used to
suppress errors. It could be that your connection is still failing, but PHP
will try to connect to run a query if a connection is not present, and the
connection PHP is trying to make on its own is succeeding where yours is
still failing. Or it could be that you changed something else in your
connection string. I would not suggest suppressing errors during
development, but rather adding suppression right before you go live. Read
the manual sections on mysql_query, mysql_connect and error suppression for
more information.
http://www.php.net/manual/en/function.mysql-query.php
http://www.php.net/manual/en/function.mysql-connect.php
http://www.php.net/manual/sv/language.operators.errorcontrol.php