Re: How to get error context
| From: | Zoltán Németh | Date: | Mon, 17 Mar 2008 09:59:06 +0000 |
| Subject: | Re: How to get error context | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-271677@lists.php.net to get a copy of this message | ||
2008. 03. 14, péntek keltezéssel 10.03-kor It Maq ezt írta:
> Here is the error message captured by my error
> handling function:
>
> mysql_connect() [function.mysql-connect]: Access
> denied for user 'admin'@'localhost' (using password:
> YES)
>
> i put a wrong password and username
the manual also says this, which I too did not notice earlier:
"Note: You can suppress the error message on failure by prepending a @
to the function name."
this implies that error message is raised on error, but don't ask me
why ;)
greets,
Zoltán Németh
> --- Zoltán Németh <znemeth@alterationx.hu> wrote:
>
> > 2008. 03. 14, péntek keltezéssel 07.40-kor It Maq
> > ezt írta:
> > > For example "mysql_connect" reprted automatically
> > the
> > > error but in the manual
> > >
> >
> http://us3.php.net/manual/en/function.mysql-connect.php
> > > all they give as information is the return:
> > "Returns
> > > a MySQL link identifier on success, or FALSE on
> > > failure.", where can i see if it throws an error,
> > and
> > > when you say throwing do you mean that i can catch
> > the
> > > error without throwing it myself?
> >
> > hmm actually what error did mysql_connect throw?
> > because if it just fails connecting, it returns
> > false. on the other
> > hand, if you provide it wrong arguments (e.g. less
> > arguments, or wrong
> > data type, or whatever) that raises a php error and
> > the function does
> > not even run.
> > this is true for most functions which return false
> > on error. the
> > returning false means there was some error with the
> > action itself, while
> > php errors are raised when the action can not be
> > executed because of
> > some error in the code itself.
> >
> > greets,
> > Zoltán Németh
> >
> > >
> > > --- Zoltán Németh <znemeth@alterationx.hu> wrote:
> > >
> > > > 2008. 03. 14, péntek keltezéssel 07.20-kor It
> > Maq
> > > > ezt írta:
> > > > > So i'm wondering if there are some rules
> > > > > that can help me know if an error will be
> > reported
> > > > > automatically or not.
> > > >
> > > > there is no general rule for that. you have to
> > check
> > > > the manual for each
> > > > function, some of them just returns false on
> > error,
> > > > others throw
> > > > warnings/notices/errors...
> > > >
> > > > greets,
> > > > Zoltán Németh
> > > >
> > > >
> > >
> > >
> > >
> > >
> >
> ____________________________________________________________________________________
> > > Never miss a thing. Make Yahoo your home page.
> > > http://www.yahoo.com/r/hs
> > >
> > >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
>
> ____________________________________________________________________________________
> Looking for last minute shopping deals?
> Find them fast with Yahoo! Search.
> http://tools.search.yahoo.com/newsearch/category.php?category=shopping
>
>