|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-05-13 23:03 UTC] peter at petermoulding dot com
I tried odbc_fetch_into() in the enclosed loop. I had to inset the reset($array) to get the loop working. I figure the function is creating new content in the array but not resetting the array pointer back to the beginning. The function should either
1/ add to the end of the array and increment the pointer
or
2/ replace the contents and reset the pointer.
$sql = "select * from stock";
$result = odbc_exec($connection["vitamins"], $sql);
if($result)
{
print("<br>Result from odbc_fetch_into()" );
$array = "";
while($result_all = odbc_fetch_into($result, 0, $array))
{
reset($array);
print("<br>" );
while(list($k, $v) = each($array))
{
print($v . " ");
}
}
}
else
{
print("<br>No result" );
}
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 23:00:01 2025 UTC |
can you please try this patch with a current build of PHP? Index: php_odbc.c =================================================================== RCS file: /repository/php4/ext/odbc/php_odbc.c,v retrieving revision 1.92 diff -u -r1.92 php_odbc.c --- php_odbc.c 11 Jun 2001 01:00:43 -0000 1.92 +++ php_odbc.c 11 Jun 2001 15:04:36 -0000 @@ -1489,6 +1489,9 @@ } zend_hash_index_update((*pv_res_arr)->value.ht, i, &tmp, sizeof(pval *), NULL); } + + zend_hash_internal_pointer_reset((*pv_res_arr)->value.ht); + if (buf) efree(buf); RETURN_LONG(result->numcols); }