Sets a ascending or descending sort order argument for the obj_select method and is called directly from the objSQL class.
void obj_sort_order ( str asc/desc )
<?php
try
{
$dbh->obj_table( "mytable" );
$dbh->obj_cols( "color,size,price" );
$dbh->obj_order_by( "color" );
$dbh->obj_sort_order( "asc" );
$rs = $dbh->obj_select();
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 );
}
$rs->obj_free_result();
}
catch ( Exception $e )
{
//log error and/or redirect user to error page
}
?>
See also: obj_cols, obj_data, obj_limit, obj_offset, obj_order_by, obj_table, obj_where