Simple i'm sure, the following code -
Gives me this result -
Any ideas?
the database is called forums and is the root.
Thanks,
Andy
Code:
<?php $handle = mysql_connect('localhost', 'root', '');
$datastoretemp = mysql_query(
"SELECT title, data
FROM forums
WHERE title = 'userstats'",
$handle);
while ($storeitem = mysql_fetch_array($datastore))
{
$datastore["$storeitem[title]"] = $storeitem['data'];
}
// get total members and newest member from template
$userstats = unserialize($datastore['userstats']);
$numbermembers = number_format($userstats['numbermembers']);
$newusername = $userstats['newusername'];
$newuserid = $userstats['newuserid'];
//Extract a list of forums and corresponding stats
$handle = mysql_connect('localhost', 'root', '');
$forumtemp = mysql_query("SELECT * FROM forums", $handle);
$totalthreads = 0;
$totalposts = 0;
//Sum posts and threads (Could do this in the sql statement)
while ($forumitem = mysql_fetch_array($forum))
{
$totalthreads += $forumitem['threadcount'];
$totalposts += $forumitem['replycount'];
}
$totalthreads = number_format($totalthreads);
$totalposts = number_format($totalposts);
echo "Members: $numbermembers" . '<br />';
echo "Total Posts: $totalposts" . '<br />';
echo "Total Threads: $totalthreads";
?></ul>
Gives me this result -
Code:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\wamp\www\wordpress\wp-content\themes\xeiro\sidebar_r.php on line 28
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\wamp\www\wordpress\wp-content\themes\xeiro\sidebar_r.php on line 51
Members: 0
Total Posts: 0
Total Threads: 0
Any ideas?
the database is called forums and is the root.
Thanks,
Andy