CodeIgniter Forums
[SOLVED] Trying to update a DATE type field in mysql using Doctrine...not working - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: [SOLVED] Trying to update a DATE type field in mysql using Doctrine...not working (/showthread.php?tid=35167)



[SOLVED] Trying to update a DATE type field in mysql using Doctrine...not working - El Forum - 10-21-2010

[eluser]Brandt1981[/eluser]
I think that it is not passing along the single quotes that it needs with the date, but not sure.

Code:
public function update_position() {
            
   $user_id = $this->input->post('empid');
            
   $position = Doctrine::getTable('Employee_position')->find($user_id);    

              
   $position->hire_dt = $this->input->post('hiredt');

   ...

   $position->save();
            
   ...  

   $vars['position'] = Doctrine::getTable('Employee_position')->findOneByemp_id($user_id);

   ...

   $this->load->view('home', $vars);
            
}


hiredt in the post above contains the date formated like:

2010-10-20

no quotes or anything...


[SOLVED] Trying to update a DATE type field in mysql using Doctrine...not working - El Forum - 10-21-2010

[eluser]kaejiavo[/eluser]
Hi Brandt,

i, too encountered some problems with doctrine and datetime fields in the database, so maybe i can help you.
Please give some details:
- database field type
- doctrine field type (from your doctrine Model)
- doctrine Error message

Marco


[SOLVED] Trying to update a DATE type field in mysql using Doctrine...not working - El Forum - 10-21-2010

[eluser]Brandt1981[/eluser]
-date
-date
-and no doctrine error message. the database is simply receiving a blank variable, and all the dates become 000-00-00

EDIT: I figured it out, I was using find instead of findByOne* to load the array with the database information.