PDA

View Full Version : some php help


P.Jackson
05-02-2004, 03:49 PM
ok i have this file for my cms

function returnforumstats() {

global $foruminfo,$forumpath,$vb_prefix;

$userdata = query_first("SELECT * FROM ".$vb_prefix."datastore WHERE title = 'userstats'");

$userdata = unserialize($userdata['data']);

$forumnewestmember = $userdata[newusername];

$forummembercount = $userdata[numbermembers];

$countthreads = query_first('SELECT COUNT(*) AS threads FROM ' . $vb_prefix . 'thread');

$posts = query_first('SELECT COUNT(*) AS count FROM ' . $vb_prefix . 'post');

$forumpostcount = intval($posts['count']);

eval("\$forumstats = \"".returnpagebit("misc_stats_forum")."\";");

return $forumstats;

}



now would would i add in there to get

Total threads
Forums users online?

Pseudomizer
05-02-2004, 10:36 PM
ok i have this file for my cms

function returnforumstats() {

global $foruminfo,$forumpath,$vb_prefix;

$userdata = query_first("SELECT * FROM ".$vb_prefix."datastore WHERE title = 'userstats'");

$userdata = unserialize($userdata['data']);

$forumnewestmember = $userdata[newusername];

$forummembercount = $userdata[numbermembers];

$countthreads = query_first('SELECT COUNT(*) AS threads FROM ' . $vb_prefix . 'thread');

$posts = query_first('SELECT COUNT(*) AS count FROM ' . $vb_prefix . 'post');

$forumpostcount = intval($posts['count']);

eval("\$forumstats = \"".returnpagebit("misc_stats_forum")."\";");

return $forumstats;

}



now would would i add in there to get

Total threads
Forums users online?

Hello P. Jackson,

i think i answered this in another thread already. Right ?

Cheers,

Boofo
05-02-2004, 11:10 PM
Another thing, why are you using these together?

$userdata = query_first("SELECT * FROM ".$vb_prefix."datastore WHERE title = 'userstats'");

$userdata = unserialize($userdata['data']);

You don't have to do the query if you are pulling date from the datastore. Get rid of the query and just do the unserialize. ;)