Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Using classes

Remember – you don’t have to use classes if you don’t want to. If you’re more comfortable using regular DB access functions then that’s fine.

Each data access class is constructed to represent one table. Each column in the table maps to a class member variable. When then class is instantiated and turned into an object, that object should represent the data for one row of the table.

When you call the save() method then class will determine if the row already exists and update the information in the table. If it does not exist, it will add a new row to the table.

So here is an example of using a class like this:

$house = new BP_House;
$house->roof = 'tiled';
$house->walls = 'wood';
$house->door = 'PVC';
$house->garden = 'grass';
$house->save();

So in this instance $house is a new object created from the class BP_House. When we call the $house->save() method, the data is saved to the database by the class.

Not sure if that helps at all.

Skip to toolbar