Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Off Topic Discussions > Other Chat

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 02-19-2009, 06:59 PM
snowman01 snowman01 is offline
Member
 
Join Date: Feb 2008
Posts: 13
Credits: 1,924
snowman01
Default Small PHP Question

Is there a PHP code to use to show the number of forums hosted? Like wherever I place the code it would say something like "Currently hosting *insert number here* forums!".
Reply With Quote
  #2  
Old 02-19-2009, 07:03 PM
BMR777 BMR777 is offline
Member
 
Join Date: Jan 2011
Posts: 1,122
Gender: Male
Credits: 10,547
BMR777 is on a distinguished road
Default RE: Small PHP Question

Well, take a look at the script below I made a while ago. It outputs your site stats including forums, users, posts, etc. :)

PHP Code:
<?php
include("create/mconfig.php");

//Connect to database...
$conn mysql_connect($dbhost$dbuser$dbpass) or die ("Cannot Authenticate to Database");
mysql_select_db($dbname);

//Loop through and get stats...

$posts 0;
$users 0;


$query "SELECT * FROM hosted_forums";
$result mysql_query($query);
$num mysql_numrows($result);

//Loop out code
$i=0;
while (
$i $num) {

//Grab the forum name
$fname=@mysql_result($result,$i,"fname");

//Loop through and see how many posts and users each forum has...

    
$query2 "SELECT * FROM ".$fname."_posts";
    
$result2 mysql_query($query2);
    
$num2 mysql_numrows($result2);

    
$posts $posts $num2;

    
$query3 "SELECT * FROM ".$fname."_users";
    
$result3 mysql_query($query3);
    
$num3 mysql_numrows($result3);

    
$users $users $num3;

$i++;
}

echo 
"<b>Site Statistics: </b><br><br>
Forums: "
.$i."<br>Users: ".$users."<br>Posts: ".$posts."";

?>
Hope it's what you need. :)
Reply With Quote
  #3  
Old 02-19-2009, 07:06 PM
snowman01 snowman01 is offline
Member
 
Join Date: Feb 2008
Posts: 13
Credits: 1,924
snowman01
Default RE: Small PHP Question

Thanks! This is what I wanted. :)
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
A small question regarding adoption limits and promo codes..c: Pear Feedback and Suggestions 2 06-25-2014 10:06 PM
small (probably) stupid question Lavaheart Questions and Supports 3 10-06-2013 11:48 PM
Small Add-On Bloodrun Mys v1.1.x Mods 6 01-18-2011 05:06 PM
Small Help jcga Questions and Supports 2 01-22-2010 09:44 PM
Small Problem SJC Questions and Supports 0 07-02-2009 09:40 AM


All times are GMT -5. The time now is 03:33 AM.

Currently Active Users: 380 (0 members and 380 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636