Re: [PHP] Weird pdo-mysql behavior

2008-11-14 Thread Thodoris
Perhaps when you try to make the connection you should check the return value and use whatever PDO error-checking methods exist to find out what went wrong, instead of blindly going forward assuming you have a database connection when you don't. As a said before I have dumped the hander

Re: [PHP] Weird pdo-mysql behavior

2008-11-14 Thread Thodoris
I agree, add some checks in your testcase so you can track exactly what is happening and see of what type your variables are. Also, try what happens when you - switch off persistent-connections (PDO::ATTR_PERSISTENT=> false) Tried that using both ways because I saw a similar error in anothe

Re: [PHP] Weird pdo-mysql behavior

2008-11-14 Thread Martijn Korse
I agree, add some checks in your testcase so you can track exactly what is happening and see of what type your variables are. Also, try what happens when you - switch off persistent-connections (PDO::ATTR_PERSISTENT=> false) - pass the object by reference (getClientFullName($id,&$dbh)) - htt

RE: [PHP] Weird pdo-mysql behavior

2008-11-13 Thread ceo
Perhaps when you try to make the connection you should check the return value and use whatever PDO error-checking methods exist to find out what went wrong, instead of blindly going forward assuming you have a database connection when you don't. Ditto for any result of ->query() What you

Re: [PHP] Weird pdo-mysql behavior

2008-11-13 Thread Thodoris
Hi Theodoris First place I'd look is to see if the sql query was successful. If it failed you'll get this error. You can try a simple test $sth = $dbh->query($sql); if ($sth == FALSE) { print "failed"; exit; } Arno Thanks for the advice but the script works in one of

RE: [PHP] Weird pdo-mysql behavior

2008-11-13 Thread Arno Kuhl
Suppose I have two tables Contracts and Clients that are connected using ClientId field. This is a stripped sample code that doesn't work: query($query); $res = $sthr->fetch(PDO::FETCH_ASSOC); return $res['Name']; } try { $dbh = new PDO('mysql:host=localhost;port=3306;dbname

Re: [PHP] Weird pdo-mysql behavior

2008-11-13 Thread Thodoris
What do you mean with 'stops working'? Also, have you created a test-script that only contains (what you think is) the core-problem? If so, can you paste it here? And if not, i advise you to make one, so you can exclude that other factors play a role here. Thodoris wrote: Hi list, I a

Re: [PHP] Weird pdo-mysql behavior

2008-11-13 Thread Martijn Korse
What do you mean with 'stops working'? Also, have you created a test-script that only contains (what you think is) the core-problem? If so, can you paste it here? And if not, i advise you to make one, so you can exclude that other factors play a role here. Thodoris wrote: > > Hi list, > I