PHP Classes

File: readme.txt

Recommend this page to a friend!
  Classes of Sergey Shilko   Abstract SQL Table to Object   readme.txt   Download  
File: readme.txt
Role: Documentation
Content type: text/plain
Description: Simple Readme First File
Class: Abstract SQL Table to Object
Map table rows to objects with Active Record
Author: By
Last change:
Date: 17 years ago
Size: 1,730 bytes
 

Contents

Class file image Download
coredb.class.php - DB OBJECT HANDLER (REQUIRE ADODB) (include dirname(__FILE__)."/adodb/adodb.inc.php";) j-coredb.class.php - JOOMLA CMS DB OBJECT HANDLER WRAPPER parent.dbtoclass.php - Database Table handler sample.php - Sample handler of table 'catalog'; ------------------------------------------------------------------- Handler Usage >>> ------------------------------------------------------------------- For example we have mysql table 'catalog', with fields 'id','title','price': What we do is : 1)Create Child class of parent.dbtoclass.php (class Foo extends dbtoclass ...) see sample.php 2)Make same fields in class as in db i.e.: see sample.php 3)you can call parent:::makeGetSetMethods() to get All get*,set* methods for all your class fields (title,price...) 4)Also you may get the list of changed values from parent class (value/field that waws realy cchanged, for logging) /* Update existing >>> */ $foo = new Foo($db); #Initialize object with DB object $foo->checkout(25); #load item details to class $foo->setNewValues($hash_array); #update class with new values $foo->commit(); #Commit all changes to db and write log $foo->finish(); #Finish work with the class. /* <<< */ /* Create new >>> */ $foo = new Foo($db); #Initialize object with DB object $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 $foo->finish(); #Finish work with the class.