php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12492 odbc_result fails accessing memo fields by number
Submitted: 2001-07-31 14:39 UTC Modified: 2002-05-21 23:04 UTC
From: huevo at earthling dot net Assigned:
Status: Closed Package: ODBC related
PHP Version: 4.0.6 OS: Win NT
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: huevo at earthling dot net
New email:
PHP Version: OS:

 

 [2001-07-31 14:39 UTC] huevo at earthling dot net
If I access a memo field (Access 2000) by name:

  $temp = odbc_result($result,'Description');

I get the expected result, a string value.

If I access the field by number:

  for ($i=1; $i<=odbc_num_fields($result); $i++)
    if (odbc_field_type($result,$i) == 'LONGCHAR')
      $temp = odbc_result($result,$i);

odbc_result fails, returning false.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-07-31 15:32 UTC] huevo at earthling dot net
Correction: I have tracked down the source of the problem; still a bug.

Code was actually like this:

for ($i=1; $i<=odbc_num_fields($result); $i++)
  if (odbc_result($result,$i)) {
     $name = odbc_field_name($result,$i);
     $value = odbc_result($result,$i);
  }

The second odbc_result returned false, the first returned the string.  I solved by assigning to a variable.

New bug:

for ($i=1; $i<=odbc_num_fields($result); $i++) {
  $test = odbc_result($result,$i);

  if (odbc_field_name($result,$i) == 'Description') {
    echo $test;
    echo odbc_result($result,'Description');
    echo odbc_result($result,$i);
  }
}

Only the first echo outputs any value.  Any accesses after the first by odbc_result to a memo field result in failure.  Good programming practice would dictate not to call odbc_result multiple times on the same data, but this behaviour is still unexpected.
 [2002-05-21 23:04 UTC] kalowsky@php.net
I believe this is now fixed.  Thank you for your bug report
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 21:01:29 2024 UTC