|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59932 db2_result($stmt, 'breed') does not work
Submitted: 2011-09-02 06:43 UTC Modified: 2011-09-02 06:47 UTC
From: mamatkazin at ivc dot orw dot ru Assigned:
Status: Closed Package: ibm_db2 (PECL)
PHP Version: 5.3.6 OS: SLES 10.3 ppc64
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: mamatkazin at ivc dot orw dot ru
New email:
PHP Version: OS:


 [2011-09-02 06:43 UTC] mamatkazin at ivc dot orw dot ru
data not retreive when second parameter is column name (not index)

      db2_result($stmt, 1) is work

      db2_result($stmt, 'breed') does not work


Reproduce code:
$sql = 'SELECT name, breed FROM animals WHERE weight < ?';
$stmt = db2_prepare($conn, $sql);
db2_execute($stmt, array(10));
while (db2_fetch_row($stmt)) {
    $name = db2_result($stmt, 0);
    $breed = db2_result($stmt, 'breed');
    print "name=$name breed=$breed";

Expected result:
name=Tom    breed=cat

Actual result:
name=Tom    breed=


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-09-02 06:47 UTC] abhargav at in dot ibm dot com
Thank you for taking the time to write to us, but this is not
a bug.


Pass the name of the column in upper case:

e.g. $breed = db2_result($stmt, 'BREED');

See the documentation:

If you check the database, the column names will be in upper-case.

Ambrish Bhargava
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Oct 24 04:03:35 2021 UTC