Sweet, figured it out!

Apparently cake caches queries unless you tell it not to:

$this->GallerysImage->cacheQueries = false;


Onward!!

:)

On Jun 25, 7:18 am, Sanfly <san...@gmail.com> wrote:
> I dont know what the heck is going on with this thread, why does it
> keep getting hijacked?
>
> Runckel,  thanks I had already tried that though and no luck
>
> Anyone else?
>
> Cheers
>
> On Jun 24, 9:58 pm, runckel <robhueb...@web.de> wrote:
>
> > Try to make a $this->GallerysImage->create() after the query, i had
> > this problem with a save condition and the create solved it.
>
> > On 24 Jun., 10:27, Sanfly <san...@gmail.com> wrote:
>
> > > Hi Guys
>
> > > I have a foreach loop, and in this foreach loop is a "query".  I need
> > > this query to be re-queried in every iteration of the loop as it
> > > changes each time.  However, no matter what I do it will only do the
> > > query once
>
> > > Ive stripped a bunch of stuff out to try and diagnose what is going
> > > on, but I just dont get it!  Can anyone fill me in on what could be
> > > going on?  And yes, there are at least two values in the array.
>
> > > The Loop:
>
> > > $i = 1;
> > >                         foreach($uploadFiles as $file){
> > >                                 //$this->GallerysImage->create();
>
> > >                                 // Order
> > >                                 echo $i . "<br>";
> > >                                 $order = 
> > > $this->GallerysImage->find("parent_id = " . $this->data
> > > ['GallerysImage']['parent_id'], "order", "order DESC");
> > >                                 //$this->data['GallerysImage']['order'] = 
> > > $order['GallerysImage']
> > > ['order'] + 1;
> > >                                 echo $i . "<br>";
> > >                                 $i++;
>
> > >                                 // other stuff goes here
> > >                         }
>
> > > The Result:
> > > 1
> > > 1
> > > 2
> > > 2
>
> > > And in the debug it only comes up once :
>
> > > 25      SELECT `GallerysImage`.`order` FROM `gallerys_images` AS
> > > `GallerysImage` LEFT JOIN `members` AS `Member` ON
> > > (`GallerysImage`.`member_id` = `Member`.`id`) WHERE parent_id = 7
> > > ORDER BY `order` DESC LIMIT 1           1       1       0
--~--~---------~--~----~------------~-------~--~----~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to