|
Method setOrderBy( $sOrder, $bAsc = true ) |
|
Written by Hidalgo Emmanuel
|
|
Description :
This Method parameter an order of classification of the lines of a collection. The classification can be done according to a field, in the ascending order or descendant.
Parameters :
$sOrder, string : Determine the field in which the objects of the collection must be classified. $bAsc (optional), Boolean: Determine the direction of sorting of the collection, “true” for ascending. By defect the order of classification will be ascending if the second parameter and omitted.
Value of return :
No parameter of return.
The following example recovers a list of “user” alphabetically classified at once “name”:
<?php
//total instanciation include_once( 'phpsimpledb.class.php' ); Global $oBDD; $oBDD = new PHPSIMPLEDB(); // loading of the “users” alphabetically $oUsers_col = $oBDD->getCollection( "users" ); $oUsers_col->setOrderBy( "name" ); $oUsers_col->load();
?>
|
|