CodeIgniter Forums
Bulk insert query with datetime field - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: General Help (https://forum.codeigniter.com/forum-24.html)
+--- Thread: Bulk insert query with datetime field (/thread-63411.html)



Bulk insert query with datetime field - muthu - 10-27-2015

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.


RE: Bulk insert query with datetime field - ignitedcms - 10-28-2015

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

Maybe not tested