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
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
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
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
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
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
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
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
Hi list,
I am developing something using PDO and I've noticed something weird
that I want to share with you. I am creating a database handler in a
script and I pass the handler to many functions I use in order to avoid
creating a new connection into the function itself. Although this works
9 matches
Mail list logo