Welcome Guest, Not a member yet? Register   Sign In
Date is being set to 0000-00-00 00:00:00, no solutions are working
#1

[eluser]JMajek[/eluser]
Hello Everyone,

AS the title states I am having trouble with setting a date created field with Codeigniter. I have tried several things via searching the forums and Stack Overflow.

I've tried now(), time(), date(), the date helper in Codeigniter, strtotime() and I still have the same issue.

I just wanted to post my code and sql query to see if you guys seem something I'm not seeing.

Thanks.

Here's the code and sql

$this->db->set('screenid', $id);
Code:
//$now = date('Y-m-d H:i:s', strtotime('now'));
$this->db->set('datecreated', date('Y-m-d H:i:s'), FALSE);  
$this->db->insert('screens');

the sql

Code:
CREATE TABLE IF NOT EXISTS `screens` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `screenid` mediumint(9) NOT NULL,
  `source` varchar(255) DEFAULT NULL,
  `datecreated` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM

Any help is greatly appreciated.


Messages In This Thread
Date is being set to 0000-00-00 00:00:00, no solutions are working - by El Forum - 02-27-2012, 08:55 AM



Theme © iAndrew 2016 - Forum software by © MyBB