The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Counting number of posts daily
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); |
#2
|
||||
|
||||
Quote:
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']; |
Благодарность от: | ||
MarkFL |
#3
|
|||
|
|||
I tried this but now it doesn't even display anything.
|
#4
|
|||
|
|||
You have to use query_first if you want it to fetch the first row.
Code:
$start = TIMENOW - 3600 * 24; $q = $vbulletin->db->query_first("SELECT COUNT(*) AS postcount FROM " . TABLE_PREFIX . "post WHERE dateline > " . $start); $dailypostcount = $q['postcount']; |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|