Lost connection with stored procedures and PHP

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

    I'm using stored procedures in a PHP site, with mysql. I'm having problems
with stored procedures. Of the two I'm using, one works all the time, consistently.
The other works correctly, but the next query returns "Lost connection to MySQL
server during query" and subsequently: "MySQL server has gone away".

    I'm using MDB2 to access the database. I tried changing the driver from
'mysql' to 'mysqli', with little success. Currently, about half of the queries
lead to a lost connection, with no apparent pattern. Current PHP code:

    $multi_query = $this->db->setOption('multi_query', true);
    $res =& $this->db->query($query);
    $data1 = $res->fetchAll();
    $id = $data1[0]['@chosen']; // this is the result I want

    // some people said the problem is related to data that is not read.
    // this loop, however doesn't seem to help at all.
    while ($res->nextResult()) {
        $row =& $res->fetchRow();

    // freeing the resource doesn't help either.
    $multi_query = $this->db->setOption('multi_query', false);

    The stored procedure works correctly 100% of the time in mysql CLI.

    Help. Any help at all, please. Thanks,

Bruno Barberi Gnecco <brunobg_at_users.sourceforge.net>
Fuch's Warning:
    If you actually look like your passport photo, you aren't well
enough to travel.

Site Timeline