Sorry guys. I figured it out. It was a strange bug with the old 1.1.18 version. I thought I updated it.... I tried to copy 1.1.19 and it the site died on me. So I need to go look into it. What I did was I changed $order to 'Post.created' with no ASC or DESC at the end and it did the trick. I think this is a bug of 1.1.18
Weird. Anyways below is the the SQL: Here is where $order = 'Post.created' which results 1 row: SELECT `Post`.`id`, `Post`.`title`, `Post`.`description`, `Post`.`price`, `Post`.`modifiers`, `Post`.`user_id`, `Post`.`temp_user_id`, `Post`.`parent_category_id`, `Post`.`child_category_id`, `Post`.`sold`, `Post`.`views`, `Post`.`date_last_view`, `Post`.`more_info`, `Post`.`sell`, `Post`.`inform`, `Post`.`publish`, `Post`.`created`, `Post`.`modified`, `Post`.`del`, `Post`.`data`, `Post`.`images`, `Post`.`file_ids`, `ChildCategory`.`id`, `ChildCategory`.`created`, `ChildCategory`.`title`, `ChildCategory`.`description`, `ChildCategory`.`date_last_post`, `ChildCategory`.`parent_category_id`, `ChildCategory`.`valid`, `ChildCategory`.`data`, `ChildCategory`.`note`, `ParentCategory`.`id`, `ParentCategory`.`created`, `ParentCategory`.`title`, `ParentCategory`.`description`, `ParentCategory`.`date_last_post`, `ParentCategory`.`valid`, `ParentCategory`.`data`, `ParentCategory`.`note`, `TempUser`.`id`, `TempUser`.`email`, `TempUser`.`validated`, `TempUser`.`preferences`, `TempUser`.`subscribe`, `TempUser`.`access_key`, `TempUser`.`created`, `TempUser`.`data`, `User`.`id`, `User`.`created`, `User`.`username`, `User`.`password`, `User`.`email`, `User`.`validated`, `User`.`contact_id`, `User`.`last_login`, `User`.`preferences`, `User`.`subscribe`, `User`.`pic`, `User`.`modified`, `User`.`num_logged`, `User`.`more_info`, `User`.`data`, `User`.`file_id` FROM `posts` AS `Post` LEFT JOIN `child_categories` AS `ChildCategory` ON (`Post`.`child_category_id` = `ChildCategory`.`id`) LEFT JOIN `parent_categories` AS `ParentCategory` ON (`Post`.`parent_category_id` = `ParentCategory`.`id`) LEFT JOIN `temp_users` AS `TempUser` ON (`Post`.`temp_user_id` = `TempUser`.`id`) LEFT JOIN `users` AS `User` ON (`Post`.`user_id` = `User`.`id`) WHERE `Post`.`publish` = 1 ORDER BY `Post`.`created` DESC LIMIT 20 20 20 0 2 SELECT `Pic`.`id`, `Pic`.`title`, `Pic`.`description`, `Pic`.`location`, `Pic`.`type`, `Pic`.`post_id`, `Pic`.`type_id`, `Pic`.`main`, `Pic`.`created`, `Pic`.`modified` FROM `pics` AS `Pic` WHERE `Pic`.`type` = "post" AND `Pic`.`type_id` IN (4440, 4428, 4430, 4431, 4436, 4437, 4412, 4414, 4417, 4418, 4419, 4420, 4423, 4424, 4426, 4405, 4406, 4408, 4386, 4387) 0 0 0 3 SELECT `Comment`.`id`, `Comment`.`created`, `Comment`.`comment`, `Comment`.`user_id`, `Comment`.`post_id` FROM `comments` AS `Comment` WHERE `Comment`.`post_id` IN (4440, 4428, 4430, 4431, 4436, 4437, 4412, 4414, 4417, 4418, 4419, 4420, 4423, 4424, 4426, 4405, 4406, 4408, 4386, 4387) ORDER BY `Comment`.`created` DESC 0 0 0 4 SELECT `File`.`id`, `File`.`name`, `File`.`description`, `File`.`url`, `File`.`model`, `File`.`model_id`, `File`.`more_info`, `File`.`user_id`, `File`.`created`, `File`.`modified`, `File`.`data`, `File`.`note` FROM `files` AS `File` WHERE `File`.`model` = "post" AND `File`.`model_id` IN (4440, 4428, 4430, 4431, 4436, 4437, 4412, 4414, 4417, 4418, 4419, 4420, 4423, 4424, 4426, 4405, 4406, 4408, 4386, 4387) 0 0 6 Here is query where $order is blank which results 20 rows: SELECT `Post`.`id`, `Post`.`title`, `Post`.`description`, `Post`.`price`, `Post`.`modifiers`, `Post`.`user_id`, `Post`.`temp_user_id`, `Post`.`parent_category_id`, `Post`.`child_category_id`, `Post`.`sold`, `Post`.`views`, `Post`.`date_last_view`, `Post`.`more_info`, `Post`.`sell`, `Post`.`inform`, `Post`.`publish`, `Post`.`created`, `Post`.`modified`, `Post`.`del`, `Post`.`data`, `Post`.`images`, `Post`.`file_ids`, `ChildCategory`.`id`, `ChildCategory`.`created`, `ChildCategory`.`title`, `ChildCategory`.`description`, `ChildCategory`.`date_last_post`, `ChildCategory`.`parent_category_id`, `ChildCategory`.`valid`, `ChildCategory`.`data`, `ChildCategory`.`note`, `ParentCategory`.`id`, `ParentCategory`.`created`, `ParentCategory`.`title`, `ParentCategory`.`description`, `ParentCategory`.`date_last_post`, `ParentCategory`.`valid`, `ParentCategory`.`data`, `ParentCategory`.`note`, `TempUser`.`id`, `TempUser`.`email`, `TempUser`.`validated`, `TempUser`.`preferences`, `TempUser`.`subscribe`, `TempUser`.`access_key`, `TempUser`.`created`, `TempUser`.`data`, `User`.`id`, `User`.`created`, `User`.`username`, `User`.`password`, `User`.`email`, `User`.`validated`, `User`.`contact_id`, `User`.`last_login`, `User`.`preferences`, `User`.`subscribe`, `User`.`pic`, `User`.`modified`, `User`.`num_logged`, `User`.`more_info`, `User`.`data`, `User`.`file_id` FROM `posts` AS `Post` LEFT JOIN `child_categories` AS `ChildCategory` ON (`Post`.`child_category_id` = `ChildCategory`.`id`) LEFT JOIN `parent_categories` AS `ParentCategory` ON (`Post`.`parent_category_id` = `ParentCategory`.`id`) LEFT JOIN `temp_users` AS `TempUser` ON (`Post`.`temp_user_id` = `TempUser`.`id`) LEFT JOIN `users` AS `User` ON (`Post`.`user_id` = `User`.`id`) WHERE `Post`.`publish` = 1 LIMIT 20 20 20 4 2 SELECT `Pic`.`id`, `Pic`.`title`, `Pic`.`description`, `Pic`.`location`, `Pic`.`type`, `Pic`.`post_id`, `Pic`.`type_id`, `Pic`.`main`, `Pic`.`created`, `Pic`.`modified` FROM `pics` AS `Pic` WHERE `Pic`.`type` = "post" AND `Pic`.`type_id` IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20) 0 0 0 3 SELECT `Comment`.`id`, `Comment`.`created`, `Comment`.`comment`, `Comment`.`user_id`, `Comment`.`post_id` FROM `comments` AS `Comment` WHERE `Comment`.`post_id` IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20) ORDER BY `Comment`.`created` DESC 0 0 0 4 SELECT `File`.`id`, `File`.`name`, `File`.`description`, `File`.`url`, `File`.`model`, `File`.`model_id`, `File`.`more_info`, `File`.`user_id`, `File`.`created`, `File`.`modified`, `File`.`data`, `File`.`note` FROM `files` AS `File` WHERE `File`.`model` = "post" AND `File`.`model_id` IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20) On May 17, 1:01 am, Abhimanyu Grover <[EMAIL PROTECTED]> wrote: > Can you paste the SQL query here, which Cake has generated for both? > > [EMAIL PROTECTED] wrote: > > for some strange reason i get the right 20 results when i do this: > > $post = $this->Post->findAll( > > null, > > null, > > 'Post.modified ASC', > > 20 > > ); > > > But when I reverse the order, I only get 1 result: > > $post = $this->Post->findAll( > > null, > > null, > > 'Post.modified DESC', > > 20 > > ); > > > Any suggestions anyone? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
