Returns the resultset record for a numeric or associative column.
mixed obj_field ( str col )
Numeric arraymixed obj_field ( int col )
Mixed
<?php
try
{
//Associative array resultset
$rs = $dbh->obj_select( "mytable", "color,size,price", "product='balloons'", "price" );
if ( $dbh->obj_error() )
throw new Exception( $dbh->obj_error_message() );
while ( $rs->obj_fetch_assoc() )
{
printf ( "%s %s %s \n", $rs->obj_field( "color" ),
$rs->obj_field( "size" ),
$rs->obj_field( "price" );
}
echo $rs->obj_num_rows();
$rs->obj_free_result();
}
catch ( Exception $e )
{
//log error and/or redirect user to error page
}
try
{
//Numeric array resultset
$rs = $dbh->obj_select( "mytable", "color,size,price", "product='balloons'", "price" );
if ( $dbh->obj_error() )
throw new Exception( $dbh->obj_error_message() );
while ( $rs->obj_fetch_num() )
{
printf ( "%s %s %s \n", $rs->obj_field( 0 ),
$rs->obj_field( 1 ),
$rs->obj_field( 2 );
}
echo $rs->obj_num_rows();
$rs->obj_free_result();
}
catch ( Exception $e )
{
//log error and/or redirect user to error page
}
?>
See also: obj_fetch_assoc, obj_fetch_num, obj_fetch_object