You need to use it like this:

$this->MailingList->create(array('email' => $email));
$this->MailingList->save();


On Apr 16, 4:19 am, Kyle Decot <[EMAIL PROTECTED]> wrote:
> I am trying to read in a line of a text file and then save it to the
> database. Below is my code:
>
> function massAdd() {
>
>                 $count = 0;
>                 $list = array("emails","emails2","emails3");
>                 foreach($list as $l):
>                 $emails = fopen("files/" . $l . ".txt","r");
>
>                 while (!feof($emails)) {
>                 // Read one email address
>                 $raw = fgets($emails, 4096);
>          echo $count++;
> if($this->MailingList->save(array($raw),false,array("email"))) : echo
> " - YES"; else: echo " - NO"; endif;
>
> echo "<br />";
>
> }
>
>                 fclose($emails);
>
>                 endforeach;
>
>         }
>
> I get all YES's but when I look into my database, it's empty. Any
> suggestions?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
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