Cannot create statement handler

From: Date: Mon, 17 Nov 2008 14:27:54 +0000
Subject: Cannot create statement handler
Groups: php.general 
Request: Send a blank email to php-general+get-283354@lists.php.net to get a copy of this message
I was wondering if anyone sees something I am bypassing: I have this sample code that works in another server: <?php function getClientFullName($dbh,$id){ // die(var_dump($dbh)); $sql = "SELECT * FROM Clients WHERE Id=".$id; // die(print $sql); $sthr = $dbh->query($sql); // die(var_dump($sthr)); $res = $sthr->fetch(PDO::FETCH_ASSOC); return $res['Name']; } try { $dbh = new PDO('mysql:host=localhost;port=3306;dbname=ins', 'root', '', array(PDO::ATTR_PERSISTENT => false)); $sql = "SELECT * FROM Contracts"; $sth = $dbh->query($sql); print "<pre>"; while($res = $sth->fetch(PDO::FETCH_ASSOC)) {
       $name = getClientFullName($dbh,$res['ClientId']);
       print $name."<br>";
} } catch (Exception $e) { print $e->getMessage(); } ?> but in my case I can't make it work on my own server. I have removed both PHP and apache and compiled everything for source just to make sure that I will avoid possible problems using rpm. It seems that if I dump $sthr it returns false. Although if I print the query and use it directly it works fine. Apache 2.2.10 PHP 5.2.6 Linux EL5 I've posted this some days ago but none had any idea about this. Do think this could be a bug? -- Thodoris

« previous php.general (#283354) next »