Hey, Where is this code being run? beforeSave, afterSave, somewhere in the controller? If you haven't performed the save yet, then getInsertID won't work.
Cheers, Graham Weldon http://grahamweldon.com e. [email protected] p. (+61) 0407 017 293 Skype: grahamweldon On Tuesday, 14 February 2012 at 3:26 PM, elogic wrote: > Hi All, > > I am using cakeDC utils csvImport to import an uploaded CSV into a > table. Everything is working besides one of the fixed fields. I have 3 > fixed fields, 2 work as required but the other is skipped everytime. I > cannot work out what is happening or why this is the case. It's not > making sense to me. > > basic code is as follows: > > // FIXED FIELDS > $estate_id = $this->data['Upload']['estate_id']; > $staff_id = $this->data['Upload']['staff_id']; > $upload_id = $this->Upload->getInsertID(); > > // ARRAY OF ABOVE FIXED FIELDS (Note When I print_r this all works) > $fixed = array('Property' => array('estate_id' => $estate_id, > 'staff_id' => $staff_id, 'upload_id' => $upload_id)); > > // IMPORTING THE CSV WITH FIXED FIELDS > $this->Upload->Property->importCSV($_SERVER["DOCUMENT_ROOT"] . '/app/ > webroot/files/csvcontacts/'. $thefilename, $fixed); > > > The estate_id and staff_id both work, the upload_id is coming though > NULL each time. > > Very strange to me. > > Thanks > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > [email protected] For more options, visit this group at > http://groups.google.com/group/cake-php > > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
