Accueil The collections
Simple handling of a collection
Written by Hidalgo Emmanuel   

In the following example we show how to update a collection of users according to their levels of enablings.

<?php


//total instanciation 
include_once( 'phpsimpledb.class.php' );
Global 
$oBDD;
$oBDD = new PHPSIMPLEDB();

//creation and loading of the collection of "users"
$oUsers_col $oBDD->getCollection"users" );
$oUsers_col->load( array( "level > 80" ) );

//update of the “users” of the collection
foreach( $oUsers_col->getObjects() as $oUser ){
    
$oUser->setData_field"level");
    
$oUser->save();
}


?>