Since cake uses the MVC pattern which incorporates a Model which in
turn is an abstraction of your data source. So in order to do it by
the MVC pattern and getting closer to "the cake way" you need to
utilize your models instead.

I would write something like this:

foreach($file_list as $file) {
   //read file contents
   //search to see if record exists
   $user = $this->User->find(*stuffs*);
   $user_id = $user["User"]["id"];

   $tmpData = array("email" => $user["User"]["email"]);

   $this->Modeltoinserto->create();
   if(!$this->Modeltoinserto->save($tmpData)) {
      echo "QQ";
   }
}

//Laeffe


On 7 Maj, 13:09, Unite <[EMAIL PROTECTED]> wrote:
> Whats not cakephp except the INSERT INTO. Yes i would use save but i
> was trying everything to see if i can get it to work. And most of it
> isnt the actual code just something i made up so i can illustrate the
> problem.
>
> How do you stop cake caching the queries?
>
> On May 7, 1:05 pm, "Marcin Domanski" <[EMAIL PROTECTED]> wrote:
>
> > >  foreach($file_list as $file) {
> > >    //read file contents
> > >    //search to see if record exists
> > >       $user_id = $this->User->query("SELECT id FROM users WHERE
> > >  emailaddress = '[EMAIL PROTECTED]'");
> > >    //if record does not exist write record to db
> > >       $this->User->query("INSERT INTO users (emailaddress) VALUES
> > >  ('[EMAIL PROTECTED]')");
> > >    //get last record inserted
> > >       $temp = $this->User->query("SELECT last_insert_id()");
> > >  }
>
> > Are you kidding ? this is not even close to cakephp i would be ashamed
> > to show such code on this group.
>
> > >  On the first loop everything works 100%.
> > >  On the second loop even though the email address has been inserted and
> > >  is in the DB (supposedly) $user_id still returns empty as if nothing
> > >  is there. I put in the sleep command to see if maybe php is running
> > >  faster than the database is updating but this has no effect. What can
> > >  I do to make sure that all query processes have been completed before
> > >  it starts the next loop?
>
> > maybe cake is caching the queries ?
>
> > --
> > Marcin Domanskihttp://kabturek.info
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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