Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Fetching info from database MyBB

Hey guys. So I'm re-doing my homepage, and I would like to place some forum stats on it.

Could someone tell me, which table the total members, posts and threads are found? I can't seem to find it!

Thank you.
[Image: O444cFs.jpg]
You can get it by reading the cache data:

PHP Code

<?php 
require_once "./global.php";
$stats = $cache->read("stats");
//number post
$stats['numposts'] = my_number_format($stats['numposts']); 
//number thread
$stats['numthreads'] = my_number_format($stats['numthreads']);
//number user
$stats['numusers'] = my_number_format($stats['numusers']); 
(Dec 2, 2012 09:31 AM)Dave85 Wrote:  You can get it by reading the cache data:

PHP Code

<?php 
require_once "./global.php";
$stats = $cache->read("stats");
//number post
$stats['numposts'] = my_number_format($stats['numposts']); 
//number thread
$stats['numthreads'] = my_number_format($stats['numthreads']);
//number user
$stats['numusers'] = my_number_format($stats['numusers']); 

Hey thanks for the reply, but I've come across this error:

Code
Direct initialization of this file is not allowed.

Please make sure IN_MYBB is defined.
Fatal error: Call to a member function read() on a non-object in /home/**/public_html/**/index.html on line 6

Ignore the .html. I'm using appache handlers.
[Image: O444cFs.jpg]
oh, you need to put define("IN_MYBB", 1);

PHP Code

<?php
define
("IN_MYBB", 1);
define('THIS_SCRIPT', 'test.php');
require_once 
"./global.php";
$templatelist = "stats,stats_thread";
$stats = $cache->read("stats");
?>
(Dec 2, 2012 12:37 PM)Dave85 Wrote:  oh, you need to put define("IN_MYBB", 1);

PHP Code

<?php
define
("IN_MYBB", 1);
define('THIS_SCRIPT', 'test.php');
require_once 
"./global.php";
$templatelist = "stats,stats_thread";
$stats = $cache->read("stats");
?>

You are very good with MyBB. Thank you very much. This is something I must learn, I had assumed that it was stored on a database and I could easily fetch the info using mysql_fetch_array().

Thanks.
[Image: O444cFs.jpg]


Possibly Related Threads...
Thread / Author Replies Views Last Post
by -PUBG-Oct 15, 2020 09:23 PM 0 77 Oct 15, 2020 09:23 PM
Last Post: -PUBG-
by James BurnhamApr 15, 2020 12:57 PM 3 181 Apr 15, 2020 12:57 PM
Last Post: Charger
by blobtownOct 3, 2016 01:40 PM 4 155 Oct 3, 2016 01:40 PM
Last Post: Rushax