PDO prepared statements sometimes returns empty resultset

PDO prepared statements sometimes returns empty resultset

am 23.04.2007 18:51:30 von Emil Ivanov

Hi,

I'm trying to get some data form a MySQL db using PDO and prepared
statement, but I noticed that sometimes it fetches an empty result set,
but sometimes does what it's supposed to do - returns the whole result set.

The environment is WinXP SP2 Home, Apache 2.2.4, PHP 5.2.1 and MySQL 5.0.27.

Here is some code:

$db = new PDO(
'mysql:host=localhost;dbname=name_of_db',
'user_name',
'password',
array (
PDO::ATTR_PERSISTENT => true
)
);
$db->query('SET CHARACTER SET utf8');
$stmt = $db->prepare("CALL sp_get_all_currencies(:lang_id)");
$stmt->bindValue(':lang_id', $currenctLanguageId, PDO::PARAM_INT);
$stmt->execute();
$currencies = $stmt->fetchAll();

So here, $currencies sometimes is an empty array, and after a refresh of
the browser it populates.

I also noticed that it works ok with $db->query(), but query doesn't
have that fancy param binding (I think).

Is there some caching or something... Is this a bug in PHP or I'm not
getting the picture right?

Regards,
Emil Ivanov

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Is there any I can do to copy data from a mysql database to access database?

am 23.04.2007 19:29:40 von Steve Smith

I have a mysql database and would like to be able to copy the data from that
to my access database. If there something that is freeware to do this? Or
maybe someone has some code that might do this for me?

Thanks in advanced.

Steve

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Is there any I can do to copy data from a mysql database to access database?

am 23.04.2007 21:40:25 von Luchino - Samel

There is a "tool" in Access that can connect an access database to any
type of database [via ODBC].
It can be used as a table, so you can make all query rigth the way as
other table.

i'm sorry but i don't remember the "tool" name.

Hope this will help.

2007/4/23, Steve Smith :
> I have a mysql database and would like to be able to copy the data from that
> to my access database. If there something that is freeware to do this? Or
> maybe someone has some code that might do this for me?
>
> Thanks in advanced.
>
> Steve
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
Samel alias Luca

"Close the world,txen eht nepo!"
"You will never break my mind!"

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php