Jump to content

How to Query DB to Return # of Posts

Recommended Posts

I'm trying to query the IPB DB to return an exact number of posts in the posts table.  I'm using the following KB article to get me started:

What I've boiled it down to was something basic like:

$select = \IPS\Db::i()->select( '*', 'forums_posts', '', 'pid', '' );
$results = count( $select );

print $results;

Given that I don't want to limit the number of results, I was trying to leave the limit field blank.  However when I do that, the change never saves and the ACP page just returns a blank white page.  I tried making the value something bigger than my current post count, but because I have almost 2M posts, IPB errors out.  It apparently does not like limits higher than like 100,000.  

I assume I'm missing something super basic here.  If someone could point me in the right direction, you'll save me a bunch of head scratching.  


Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...