Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
count returns an error
from the docs: $query = Model_Article::find()->where('category_id', 1)->order_by('date', 'desc'); // We want to know the total number of articles for pagination
$number_of_articles = $query->count(); that returns database error because no column field is referenced in the count() command to solve it, I have to pass one of the column field to the count call such as count('id')
In theory I think it should default to id... but I'm not certain why it would need a field to count at all. Wouldn't all results have the same fields and be counting rows instead of fields within rows?
it should, at least count(*) so it won't return an error, could it be a performance issue? To use count(*) I mean
Hmm, that's weird. It should use "id" when no column was given. Make a bugreport on github.com/fuel/orm/issues, but make sure you've updated your Fuel base to RC3 first.
Add a Comment
It looks like you're new here. If you want to get involved, click one of these buttons!
Apply for Membership
↳ Job Board
↳ Installation & Setup
↳ Tips and Tutorials
↳ Code share
In this Discussion