1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

MySQL count vs PHP count

Discussion in 'General PHP and MySQL Discussions' started by chrisj, Aug 17, 2012.

  1. chrisj

    chrisj Active Member

    Why would xenforo use mysql count and add an extra query?

    For example XenForo_ControllerPublic_Member actionIndex gets an array of all the users with getUsers and then it calls countUsers as well.
     
  2. Syndol

    Syndol Guest

    Because in this case getUsers() is only fetching X number of members as indicated by the 'perPage' and 'page' parameters, while countUsers() fetches the total count of (valid none banned) members.
     
    chrisj likes this.
  3. chrisj

    chrisj Active Member

    Thanks, I should have spent more time thinking about it.
     

Share This Page