CodeIgniter Forums

Full Version: Bulk insert query with datetime field
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
HI,

I'm still struggle to insert bulk insert data with datetime column to database.

Currently i'm using, if any datetime column in database means,   the below codes i use

        $pub_contact_info = array(
           'cc_contact_id'        => $pub_contact_id,
        );
        $this->db->set('cc_created_date', 'NOW()', FALSE);
        $this->db -> insert('ch_contact', $pub_contact_info);

But, in batch insert means, how can i use NOW() in insert_batch() function

Thanks in advance.
Try:
Code:
$right_now = date("Y-m-d H:i:s");
$this->db->set('cc_created_date', $right_now, FALSE);

Maybe not tested