2012年7月18日 星期三

ZEND-DB基礎

查詢
   
            
  $ObjSeJson = $this->objAdapters['DbConfig']
                        ->select()
                        ->from('TableName');
  
                        ->where('AdvertisingClass !='.'"App"');
                        ->where('Showx=?','1')
                        ->where('AdvertisingClass!=?','App');
                        ->where('lottery_userVoteID IS NULL')
                        ->where('lottery_userMail IS NOT NULL')
                        ->order('RAND()')
                        ->order(array('Sort','ID desc'))


  $aryJson = $this->objAdapters['DbConfig']->fetchall($ObjSeJson);  

新增
               
 $AryInData = array('DbTableName_A' => $this->_request->get('DbTableName_A'),
                           'DbTableName_B' => $this->_request->get('DbTableName_B'));
                  
 $this->objAdapters['DbConfig']->insert('TableName',$AryInData);     
        $IntNewID = $this->objAdapters['DbConfig']->lastInsertId(); 

修改
               
$AryInData = array('DbTableName_A' => $this->_request->get('DbTableName_A'),
                  'DbTableName_B'=>$this->_request->get('DbTableName_B'));                         
$this->objAdapters['DbConfig']->update('TableName',$AryInData,'ID='.$this->_request->get('ID'));

刪除
               
$this->objAdapters['DbConfig']->delete('TableName','ID='.$this->_request->get('ID'));

沒有留言:

張貼留言