a bug in DB_common

[email protected] (Alexey Borzov) Mon, 12 Mar 2001 11:08:22 +0300
Newsgroups php.pear
Organization RDW
Message-ID <[email protected]>
Greetings, php-pear!


in function getAssoc() there is a loop which is supposed to return
array of the form (first_col => second_col):

            // return scalar values
            while (($row = $this->fetchRow($res)) && !DB::isError($row)) {
                $results[$row[0]] = $row[1];
            }

it insists on accessing the $row's values by numeric indices and fails
miserably when the default fetchmode is DB_FETCHMODE_ASSOC. I suppose
the loop should read:

            // return scalar values
            while (($row = $this->fetchRow($res, DB_FETCHMODE_ORDERED)) && !DB::isError($row)) {
                $results[$row[0]] = $row[1];
            }


--
Yours, Alexey V. Borzov, Webmaster of RDW.ru