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, 07:59 PM
snowman01 snowman01 is offline
Member
 
Join Date: Feb 2008
Posts: 13
Credits: 2,166
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, 08:03 PM
BMR777 BMR777 is offline
Member
 
Join Date: Jan 2011
Posts: 1,122
Gender: Male
Credits: 13,534
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, 08:06 PM
snowman01 snowman01 is offline
Member
 
Join Date: Feb 2008
Posts: 13
Credits: 2,166
snowman01
Default RE: Small PHP Question

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


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 11:06 PM
small (probably) stupid question Lavaheart Questions and Supports 3 10-07-2013 12:48 AM
Small Add-On Bloodrun Mys v1.1.x Mods 6 01-18-2011 06:06 PM
Small Help jcga Questions and Supports 2 01-22-2010 10:44 PM
Small Problem SJC Questions and Supports 0 07-02-2009 10:40 AM


All times are GMT -5. The time now is 03:13 PM.

Currently Active Users: 800 (0 members and 800 guests)
Threads: 4,081, Posts: 32,031, 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