Home  >  Article  >  Backend Development  >  ON UPDATE CURRENT_TIMESTAMP is invalid

ON UPDATE CURRENT_TIMESTAMP is invalid

WBOY
WBOYOriginal
2016-08-04 09:21:263699browse

MYSQL updatetime The field is set to ON UPDATE CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP is invalid
But after performing the UPDATE operation, the time in the database is still the time when it was added. What may be the cause?

public function updateInfo($cid,$data){
        $this->db->set($data);
        $this->db->where('cid',$cid);
        if($this->db->update('report')){
            return TRUE;
        } else {
            return FALSE;
        }
    }

Reply content:

MYSQL updatetime The field is set to ON UPDATE CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP is invalid
But after performing the UPDATE operation, the time in the database is still the time when it was added. What may be the cause?

public function updateInfo($cid,$data){
        $this->db->set($data);
        $this->db->where('cid',$cid);
        if($this->db->update('report')){
            return TRUE;
        } else {
            return FALSE;
        }
    }

It may be that the data in your update this time is completely consistent with the database table data, and the affected rows may be 0.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn