Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Count related
  • Hi,

    I have "Concours" has many "user". In my backoffice for show how many user have a concours, i use count($concours->users). But with 8150 users in one concours, i can see some lag...

    What's the best way for just get the number of "User" in a "Concours" ? I need to do manually a query ?
  • HarroHarro
    Accepted Answer
    try: $count = Model_User::count(array('where' => array(array('concours_id', '=', $concours->id))));

    If you try to access the data via it's parent, a lazy load query will start, so you're basically selecting 8150 records just to do a count.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion