CodeIgniter Forums
timestamp - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: timestamp (/showthread.php?tid=47797)



timestamp - El Forum - 12-22-2011

[eluser]ibnclaudius[/eluser]
I'm trying to save the current timestamp in database but I alway got registered 0000-00-00 00:00:00

Code:
$data = array('username' => $this->input->post('username'),
           'name' => $this->input->post('name'),
       'email' => $this->input->post('email'),
         'password' => $this->input->post('password'),
       'timestamp' => time()
   );
$this->Usermodel->create('users', $data);

Code:
CREATE TABLE `users` (
`id` int(11) NOT NULL auto_increment,
`username` varchar(255) NOT NULL,
`name` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`timestamp` timestamp NOT NULL,
PRIMARY KEY  (`id`)
) ENGINE=MyISAM ;

Code:
function create($table, $data) {
$this->db->insert($table, $data);
}