Bug #12492 Updated: odbc_result fails accessing memo fields multiple times
| From: | huevo at earthling dot net | Date: | Tue, 31 Jul 2001 19:32:20 +0000 |
| Subject: | Bug #12492 Updated: odbc_result fails accessing memo fields multiple times | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-61680@lists.php.net to get a copy of this message | ||
ID: 12492
User updated by: huevo@earthling.net
Reported By: huevo@earthling.net
Old Summary: odbc_result fails accessing memo fields by number
Status: Open
Bug Type: ODBC related
Operating System: Win NT
PHP Version: 4.0.6
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2001-07-31 14:39:50] huevo@earthling.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.
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=12492&edit=1