• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ActiveRecord & inserting dates

#1
[eluser]Macros[/eluser]
I'm just really digging into CI's database library & the Active Record implementation. I'm running into a problem trying to insert dates into a MySQL database.

My code is:
Code:
$data = array(
    'firstname' => $this->validation->firstname,
    'lastname' => $this->validation->lastname,
    'email' => $this->validation->email,
    'password' => $this->validation->password,
    'created' => time(),
);
$this->db->insert('users', $data);
This causes the date to be invalid and not be inserted correctly. Now, I could just pass thru a string with the date in it, but that's not valid SQL. Would work with MySQL (& I'll probably do that as a fix) but may not if using another server.

This must be a common issue, I don't see any helpers or anything that would help with this, and a search of the forums only found formatting output, not inserts!

Cheers, Cameron.


Messages In This Thread
ActiveRecord & inserting dates - by El Forum - 07-01-2008, 05:02 AM
ActiveRecord & inserting dates - by El Forum - 07-01-2008, 05:42 AM
ActiveRecord & inserting dates - by El Forum - 07-01-2008, 06:31 AM
ActiveRecord & inserting dates - by El Forum - 07-01-2008, 06:35 AM
ActiveRecord & inserting dates - by El Forum - 07-01-2008, 06:48 AM
ActiveRecord & inserting dates - by El Forum - 07-08-2008, 07:44 PM
ActiveRecord & inserting dates - by El Forum - 07-09-2008, 12:38 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.