php.net |  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
 [2011-09-02 06:43 UTC] mamatkazin at ivc dot orw dot ru
Description:
------------
data not retreive when second parameter is column name (not index)

Therefore
      db2_result($stmt, 1) is work

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

 

Reproduce code:
---------------
<?php
$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=

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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.

Hi,

Pass the name of the column in upper case:

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

See the documentation: http://in3.php.net/manual/en/function.db2-result.php

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

Regards,
Ambrish Bhargava
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 10:01:31 2024 UTC