Welcome Guest, Not a member yet? Register   Sign In
count_all_results() with complex WHERE clause
#2

[eluser]crikey[/eluser]
This is what I do (may or may not help):

For model functions that I use with pagination, I add an extra parameter (eg $count_only = FALSE). Then when I call the function, I do it twice, once passing TRUE for $count_only, in which case I ignore limits and offsets just to get the total results, and then again without a parameter (or passing it as FALSE if need be) to get the actual pagination page set - 20 records in your case.

My model function looks at the $count_only parameter and if it's TRUE, then use count_all_results(), ignoring limits and offsets, otherwise apply limits and offsets and use $this->db->get() - in your case the second call will also include the custom_field.

Hope that helps,
Grant


Messages In This Thread
count_all_results() with complex WHERE clause - by El Forum - 11-29-2010, 10:27 PM
count_all_results() with complex WHERE clause - by El Forum - 11-29-2010, 11:15 PM
count_all_results() with complex WHERE clause - by El Forum - 11-29-2010, 11:20 PM



Theme © iAndrew 2016 - Forum software by © MyBB