On Mon, May 16, 2011 at 11:40 AM, Silvio Siefke <li...@silvio-siefke.de>wrote:

> Hello,
> On Mon, 16 May 2011 11:06:17 +0100 Stuart Dallas wrote:
> > In order to avoid this problem in future I encourage you to check the
> return
> > value of every function call you make that might fail, i.e. every single
> > one! Had you done that here, and then pulled out the last error message
> from
> > PDO you would not have had this problem for longer than a minute.
> im sorry, but what u mean? Can u give example. I really starting with PHP
> and when have error messages in log there is no problem for me, i can fix
> the
> mistakes in script, but when php write no messages to log i not know where
> should search.
> I has try with xdebug, but this want not work or i understand it wrong. And
> which ways for debug give in PHP?

Not all functions raise PHP errors when they fail, in fact most don't. Most
will return an error value, and a few throw exceptions.

As the manual states, the execute method you're using will return true if it
succeeded or false if it failed (http://php.net/pdostatement.execute). You
can then use the errorInfo method to get details of the actual error (

The best piece of advice I can give you if you're just starting out is...
only ever assume that all of the code you write will fail, and make sure it
handles failures appropriately. Any other assumptions are likely to come
back and bite you on the arse one way or another.

Oh, and read the manual entry for every function, class and method you're
using thoroughly!


Stuart Dallas
3ft9 Ltd

Reply via email to