alvin567 Posted May 29, 2012 Share Posted May 29, 2012 Lets say I want to query from cakephp the range of number 1,2,3,4,5,6,7,8,9,10-20,20-40 of a certain group how can I do so? Link to comment https://forums.phpfreaks.com/topic/263305-cakephp-range/ Share on other sites More sharing options...
thehippy Posted May 29, 2012 Share Posted May 29, 2012 You may be looking to use the underlying SQL functionality of BETWEEN or you may be able to get away with LIMIT depending on your needs. Link to comment https://forums.phpfreaks.com/topic/263305-cakephp-range/#findComment-1349462 Share on other sites More sharing options...
smoseley Posted May 29, 2012 Share Posted May 29, 2012 Cake's ORM sucks. Write the query yourself... $sql = "SELECT * FROM table_name AS ModelName WHERE column_name IN(1,2,3,4,5,6,7,8,9) OR column_name BETWEEN 10 AND 20 OR column_name BETWEEN 20 AND 4;" $result = $this->ModelName->query($sql); Link to comment https://forums.phpfreaks.com/topic/263305-cakephp-range/#findComment-1349468 Share on other sites More sharing options...
alvin567 Posted May 30, 2012 Author Share Posted May 30, 2012 i agree it sucks so how do I go by case by case basis? should I use an array or a loop construct? Link to comment https://forums.phpfreaks.com/topic/263305-cakephp-range/#findComment-1349734 Share on other sites More sharing options...
smoseley Posted May 30, 2012 Share Posted May 30, 2012 I just showed you how to do it. Link to comment https://forums.phpfreaks.com/topic/263305-cakephp-range/#findComment-1349763 Share on other sites More sharing options...
alvin567 Posted June 5, 2012 Author Share Posted June 5, 2012 it was solved,you showed me how to do it in another thread,thanks! Link to comment https://forums.phpfreaks.com/topic/263305-cakephp-range/#findComment-1351278 Share on other sites More sharing options...
smoseley Posted June 5, 2012 Share Posted June 5, 2012 Cheers! Link to comment https://forums.phpfreaks.com/topic/263305-cakephp-range/#findComment-1351284 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.