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 <[email protected]> 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 [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 -~----------~----~----~----~------~----~------~--~---
