Example 1. A db2_result() example
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"; } ?>
|
The above example will output:
cat Pook
gold fish Bubbles
budgerigar Gizmo
goat Rickety Ride |