objSQL Resultset Methods
Associative Resultsets
The obj_fetch_assoc() method returns a resultset as an associative array.
Returns: Array or null if no more rows
The obj_field() method returns the resultset record for the named column and is case-sensitive.
Returns: Mixed
See also: Numeric Resultsets | Object Resultsets | Result/Resultset Statement Methods
<?php
try
{
    $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
} 
?>
Numeric Resultsets
The obj_fetch_num() method returns a resultset as a numeric array.
Returns: Array or null if no more rows
The obj_field() method returns the resultset record for the numeric column.
Returns: Mixed
<?php
try
{
    $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
} 
?>
Object Resultsets
The obj_fetch_object() method returns a resultset as an object. The fields ( column names ) are case-sensitive.
Returns: Object or null if no more rows
<?php
try
{
    $rs = $dbh->obj_select( "mytable", "color,size,price", "product='balloons'", "price" );
    
    if ( $dbh->obj_error() )
        throw new Exception( $dbh->obj_error_message() );
        
    while ( $obj = $rs->obj_fetch_object() ) 
    {
        printf ( "%s %s %s \n", $obj->color, 
                                $obj->size, 
                                $obj->price );
    }
    
    echo $rs->obj_num_rows();
    
    $rs->obj_free_result();
}
catch ( Exception $e ) 
{
    //log error and/or redirect user to error page
} 
?>
Result/Resultset Statement Methods
The obj_num_rows() method returns the number of rows from a select statement.
Returns: Unsigned integer or -1 on failure
The obj_num_fields() method returns the number of fields from a select statement.
Returns: Unsigned integer or -1 on failure
The obj_affected_rows() method returns the number of affected rows from an insert/update/delete statement.
Returns: Unsigned integer or -1 on failure
The obj_free_result() method frees the statement and resultset resources from a select statement.
Returns: True or False on failure
<?php
try
{
    $rs = $dbh->obj_select( "mytable", "color,size,price", "product='balloons'", "price" );
    
    if ( $dbh->obj_error() )
        throw new Exception( $dbh->obj_error_message() );
        
    echo $rs->obj_num_rows();
    echo $rs->obj_num_fields();
    
    $rs->obj_free_result();
    
    $rs = $dbh->obj_update( "mytable", array( "color" => "blue" ), "id=6" );
    
    if ( $dbh->obj_error() )
        throw new Exception( $dbh->obj_error_message() );
        
    echo $rs->obj_affected_rows();
    
}
catch ( Exception $e ) 
{
    //log error and/or redirect user to error page
} 
?>