Quote:
Originally Posted by Raakin
I am trying to use this in a plugin but it keeps displaying Resource id #107 or some number instead of the actual post count.
Code:
$start = TIMENOW - 3600 * 24;
$dailypostcount = $vbulletin->db->query_read("SELECT COUNT(*) FROM " . TABLE_PREFIX . "post WHERE dateline > " . $start);
How can get the actual post count?
|
The result from the a database query is not just one field, it is an array (i.e. resource) of all fields returned by the query.
To get the result from your query change the query as follows:
Code:
$start = TIMENOW - 3600 * 24;
$dailypostcount = $vbulletin->db->query_first("SELECT COUNT(*) AS postcount FROM " . TABLE_PREFIX . "post WHERE dateline > " . $start)['postcount'];