<?php
require_once 'Mysql.php';
require_once 'ExampleObject.php';
Mysql::Init('hostname', 'username', 'password', 'databasename');
$exampleobj = new ExampleObject();
//create iterator to select all data from table, deny cacheing
$iterator = new BaseObjectIterator('SELECT * FROM '.$exampleobj->GetTableName(), $exampleobj, false);
foreach($iterator as $index => $obj) {
$obj->field2 .= ' changed';
//if object defines some special function, call if needed
//save changed object
$obj->Save();
}
?>
|