If you all take and look at the BaseModel insert and update methods, you will see how it's done.
PHP Code:
// BaseModel Class
protected $useTimestamps = true; // if you look at the methods this has to be set to true
// The fields have to be in the database table.
-- insert method
if ($this->useTimestamps && $this->createdField && ! array_key_exists($this->createdField, $data)) {
$data[$this->createdField] = $date;
}
if ($this->useTimestamps && $this->updatedField && ! array_key_exists($this->updatedField, $data)) {
$data[$this->updatedField] = $date;
}
-- update method
if ($this->useTimestamps && $this->updatedField && ! array_key_exists($this->updatedField, $data)) {
$data[$this->updatedField] = $this->setDate();
}
Hope that this sheds some light on this.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )