Only This Book All of Safari
Code Fragments only
DataObject performs two tasks. First, it builds SQL statements based on the object's variables and the builder
methods. Second, it acts as a datastore for a table row. There's a core class, which you extend for each of
your tables so that you put the data logic inside the data classes. There's also an included Generator to make
<?php
/**
* Table Definition for user
* www.knowsky.com
*/
require_once 'DB/DataObject.php';
class DataObjects_User extends DB_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
var $__table = 'user'; // table name
var $user_Id; // int(11) not_null primary_key auto_increment
var $first_Name; // string(30) not_null
var $last_Name; // string(40) not_null
var $email; // string(100) not_null
/* Static get */
function staticGet($k,$v=NULL) {
return DB_DataObject::staticGet('DataObjects_User',$k,$v);
}
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
}
?>
index.php
1 <?
2 require("include.php");
3 $smarty->assign('TITLE','ACCESS MySQL DATABASE IN THREE TIERS WITH PHP');
4 $smarty->assign('HEADER','WHAT WISH DO ?');
5 $smarty->display('index.tpl');
?>