On IBM DB2 for iSeries I have to specify a specific row number to retrieve. If I don't specify the row number, the behavior is erratic.
This seems to work:
<?php
for($i=1;$row=odbc_fetch_row($result,$i);$i++) {
//use $row
}
?>
The row count MUST start at 1 or else the behavior seems undefined; i.e., when I start from 0 some rows might be returned two or more times or not at all.