Help - Search - Members - Calendar
Full Version: Displaying IPB Stats
Pixel2Life Forum > Member Tutorials and Requests > Forum Tutorial Archives > PHP Tutorials
Slashman X
Didnt see it posted here so i thought i'd post a tut for this

CODE
<?php
    //CONNECT TO FORUMS DB//
  $conn = mysql_connect("localhost","FORUMSDBUSERNAME","DBPASSWORD");
   mysql_select_db(FORUMDBNAME) or die(mysql_error());
$members = mysql_query("SELECT * FROM ibf_members");//Selects the member db
$total_members = mysql_num_rows ($members);//Counts the # of rows of member db
$posts = mysql_query("SELECT * FROM ibf_posts");//Selects post db
$total_posts = mysql_num_rows ($posts);//Counts rows of post db

?>


Put That At the top of the page, replace capital letters in $conn

Now somewhere in your page put

CODE
<?php
echo $total_members;
                    
echo $total_posts;
?>


to show the stats
Xuxiix
This isn't much of a tutorial. And, about this: "Put That At the top of the page, replace capital letters in $conn." What about the "FORUMDBNAME" in mysql_secelt_db? They don't have to edit that? (Because it's not in $conn.) Oh, and also, what if they aren't runnning their MySQL server on localhost? (Although I know most people does.) You should also describe it some more.

Ahh well, too much critism, and maybe I'm just expecting more from tutorials. By the way, it's a nice cool little trick.

Kkthxbai. rolleyes.gif
Slashman X
I knows it not much, btw, FORUMDBNAME is just under $conn victory.gif
Xuxiix
QUOTE(Slashman X @ Apr 3 2007, 02:30 AM) *
I knows it not much, btw, FORUMDBNAME is just under $conn victory.gif

You mean below it? tongue.gif
Ghost
"Under" means "below"... blink.gif
Xuxiix
QUOTE(Ghost @ Apr 12 2007, 10:43 AM) *
"Under" means "below"... blink.gif

Oh. angrylooking.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.