The following example demonstrates how to iterate through a result set
with db2_fetch_row() and retrieve columns from the
result set with db2_result().
<?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 $breed";
}
?>
Результат выполнения данного примера:
cat Pook
gold fish Bubbles
budgerigar Gizmo
goat Rickety Ride