Thanks Maj... 

-----Original Message-----
From: cake-php@googlegroups.com on behalf of majna
Sent: Thu 6/28/2007 16:41
To: Cake PHP
Subject: Re: multiple line file import problem.
 

 Add befrore save
$this->User->create();

// save the imported user data
$this->User->save($this->data);

On Jun 28, 8:56 am, "Gould, Adrian" <[EMAIL PROTECTED]>
wrote:
> I am attempting to import a file that has been uploaded to a imports folder 
> in the correct location...
>
> I have had the import routine saving an entry, but when the next line is 
> imported it does nto create a new record but updates the previous one.
>
> How can I do this...
>
>         // open the file for reading
>         if (! $fd = @fopen($csvFile, "r")) {
>                 die("Failed to open input file");
>         }
>
>         // set header to true
>         $header = true;
>         // read the file using the automatic csv conversion routines
>         while ($fields = fgetcsv($fd)) {
>
>                 // if it the header then skip the row
>                 if ($header) { /* skip CSV header row */
>                         $header = false;
>                         continue;
>                 }
>                 else
>                 {
>                         // parse the imported data into the data array ready 
> for saving
>                         $this->data =  $this->__parse_csv_row($fields);
>                         // save the imported user data
>                         $this->User->save($this->data);
>                 }
>         }
>
> Am I barking up the wrong tree on the way ->save works? Can I not get it to 
> function this way?
>
> Thanks
>
> Ady





--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to