Welcome Guest, Not a member yet? Register   Sign In
insert date
#2

[eluser]Phil Sturgeon[/eluser]
Had a similar problem myself, it will try to treat that entry like it is a string - meaning it will put data = "NOW()" instead of date = NOW().

Use the code:

Code:
$input = array(
    'title'            => $title,
    'description'             => $desc,
    'tag'             => $tag,
    'attachment'            => $file,
    'max'            => $max,
    'date'            => date('Y-m-d h:m:s')
// or the unix version
    'date'            => now()
    );
$this->db->insert('some_table',$input);

For the 2nd option you will need date helper loaded. Or just use the time() function, they do almost the exact same thing except for it can be turned to local timezone or GMT timezone in the CI config.


Messages In This Thread
insert date - by El Forum - 12-30-2007, 04:14 PM
insert date - by El Forum - 12-30-2007, 07:56 PM
insert date - by El Forum - 12-30-2007, 09:00 PM
insert date - by El Forum - 12-30-2007, 11:17 PM
insert date - by El Forum - 12-31-2007, 02:30 AM
insert date - by El Forum - 04-19-2008, 12:32 AM
insert date - by El Forum - 04-19-2008, 02:03 AM



Theme © iAndrew 2016 - Forum software by © MyBB