Afficher un message
Vieux 14/03/2008, 17h13   #7
Zoltán Németh
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] How to get error context

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 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
>
>


  Réponse avec citation
 
Page generated in 0,05428 seconds with 9 queries