Model of Modular Structure ZEND Reviewed by Momizat on . modules/default/models/DbTable/Frontend.php [php] <?php class Default_Model_DbTable_Frontend extends Zend_Db_Table_Abstract { public function insertdata($tbl modules/default/models/DbTable/Frontend.php [php] <?php class Default_Model_DbTable_Frontend extends Zend_Db_Table_Abstract { public function insertdata($tbl Rating: 0

Model of Modular Structure ZEND

modules/default/models/DbTable/Frontend.php

<?php

class Default_Model_DbTable_Frontend extends Zend_Db_Table_Abstract
{
   public function insertdata($tbl,$params)
    {
			$this->_db->insert($tbl, $params);
            return $last_insert_id = $this->_db->lastInsertId();
	}	
	public function updatedata($tbl,$params,$fld,$id)
    {
		$id=$this->_db->update($tbl, $params, array($fld.'= ?' => (int) $id));
		return $id;
	}
	public function deletedata($tbl,$fld,$id)
    {	
		$id=$this->_db->delete($tbl, array($fld.'= ?' => $id));
	}
	public function loginuser($username,$password)
    {
			
        $select = $this->_db->select()
                        ->from('tbl_admin')
                       ->where('email=?',$username)
                       ->where('status=?','1')
                        ->where('password=?',$password);
                        
          $rec=$this->_db->fetchRow($select);
          $select->reset();          
        return $rec;
    } 
	public function getuserdetail($id)
    {
	$where="id=".$id;		
        $select = $this->_db->select()
                        ->from('tbl_admin')
                       // ->columns('name')
                        ->where($where);
                        //orWhere for or condition and don't use array for where function
                        //group
                        //order
                        //limit(20, 10)
          $rec=$this->_db->fetchRow($select);
          $select->reset();          
        return $rec;
    } 
    	public function getalluser()
    {
		
        $select = $this->_db->select()
                        ->from('tbl_admin');
        $rec=$this->_db->fetchAll($select);
         $select->reset(); 
         return  $rec;
    } 
}
?>

Leave a Comment

© 2014 Powered By