MyBB Community Forums

Full Version: Can figure how to use simple select?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I can't figure how to count posts limited by dateline?

$datecut = TIME_NOW - (86400);
$query = $db->simple_select("threads", "COUNT(pid) AS count", "dateline = $datecut");
$test = $db->fetch_field($query, "count");
If you are trying to get the number of threads posted in the last 24 hours:
$query = $db->simple_select('threads', 'COUNT(pid) AS count', 'dateline >= '.$datecut);

If you are trying to get the the number of threads posted before 24 hours ago:
$query = $db->simple_select('threads', 'COUNT(pid) AS count', 'dateline <= '.$datecut);
You should be querying the posts table, not the threads table.

$query = $db->simple_select("posts", "COUNT(pid) as count", "dateline >= $datecut");
Thanks guys was so close Smile +1