2011-09-11 28 views

回答

0

如果您正在使用笨要做到這一點,建立一個模型,然後一個功能,將做到以下幾點:

public function updateDateTime($id) 
{ 
    $this->db->set('status', '1'); 
    $this->db->set('datetime', 'CURRENT_TIMESTAMP', TRUE); 
    $this->db->where('id', $id); 
    $this->db->update('table'); 
} 

參考:http://codeigniter.com/user_guide/database/active_record.html#insert

+2

它不應該是'$這個 - > db-> set('datetime','CURRENT_TIMESTAMP',FALSE);'?根據文檔:'set()也會接受一個可選的第三個參數($ escape),如果設置爲FALSE,這將防止數據被轉義。 – Ragnagord

相關問題