<?php
 
 
/* Update existing  >>> */
 
 
#$foo = new Foo($db);                     #Initialize object with DB object
 
#$foo->checkout(25);                    #load item details to class
 
#$hash_array = array('title'=>'sometitle','price'=>'99.99');
 
#$foo->setNewValues($hash_array);    #update class with new values
 
#$foo->commit();                        #Commit all changes to db and write log
 
#3$foo->finish();                        #Finish work with the class.
 
 
/* <<< */
 
 
/* Create new  >>> */
 
 
#$foo = new Foo($db); #Initialize object with DB object
 
#$hash_array = array('title'=>'sometitle','price'=>'99.99');
 
#$foo->create($hash_array);               #Commit all changes to db and write log
 
#$foo->finish();               #Finish work with the class.
 
 
/* <<< */
 
 
/* Delete record */
 
 
#$foo = new Foo($db);            #Initialize object with DB object
 
#$foo->delete(25);               #Delete item #25
 
#$foo->finish();               #Finish work with the class.
 
 
 
class Foo extends dbtoclass{
 
var $title;
 
var $price;
 
 
var $dbtable = 'catalog'; #table name 
 
var $pkeyfld = 'id';
 
 
function Foo($db){
 
        if(is_object($db)){$this->db = $db;}else{die('CLASS MUST HAVE DB');}
 
}
 
 
 
function getTitle(){
 
return $this->title;
 
}
 
 
function setTitle($var){
 
    $this->title = $var;
 
}
 
function getPrice(){
 
return $this->price;
 
}
 
 
function setPrice($var){
 
    $this->price = $var;
 
}
 
 
}
 
?>
 
 |