Search code examples
phpsqlexpressionengine

Having trouble with Expression Engine's Query module when using limit clause


Well, I hit up IRC without any luck, tried the message forum without any luck. I'll give old faithful StackOverflow a shot.

I am using ExpressionEngine 2.1 and using the query module to generate a memberlist. The memberlist is rather large and I would like to paginate it. According to the docs, I use my limit clause outside of my sql statement.

Here's the query:

{exp:query sql="SELECT * FROM exp_members WHERE group_id=5 OR group_id=7 OR group_id=8 OR group_id=9 OR group_id=10 OR group_id=11 OR group_id=12" limit="10"  paginate="bottom"}

The page still attempts to grab all members, gets hung up, and displays the out of memory error. If I hard code the limit clause in the sql statement it returns as expected, but then I lose the pagination. Trying not to write new pagination code.

Anyone experience this and have a fix, or any ideas?


Solution

  • Well, as I understand, the "limit" function on the query tag doesn't limit your result set, so that's why the page gets hung up. What the limit function does is setting how many results you show on a page when using pagination. You are gonna have to use the limit on the query for what you want. Hope this information helps.