Copy CodeThe code is as follows:
/**
* Data Access Object Example
*
* @create_date: 2010-01-04
*/
Class Basedao
{
var $_db = null;
var $_table = null;
function Basedao ($config)
{
$this->_db = new MySQLdb (); It's not working here.
}
/**
* Get processing
*
* @param array $filter//filter conditions
* @param string $field//Get field
* @param int $page//Current page
* @param int $limit//page
*/
function Fetch ($filter = Array (), $field = "*", $page = 1, $limit = null)
{
$this->_db->select ($filed)->from ($this->_table)->where ($filter)->limit ($page, $limit);
return $this->_db->execute ();
}
function Update () {}
function Delete () {}
function Insert () {}
}
Class Memberdao extends Basedao
{
var $_table = "Member";
}
$oMember = new Memberdao ();
$oMember->fetch ();
/**
* Places to use:
* Model layer base class in MVC
*/
?>
http://www.bkjia.com/PHPjc/323783.html www.bkjia.com true http://www.bkjia.com/PHPjc/323783.html techarticle Copy the code as follows:? PHP/** * Data Access Object Example * * @create_date: 2010-01-04 */class Basedao {var $_db = null; v AR $_table = null; function Ba ...