PHP Help - Display forum online and total members on main page

Reply

Join Date: Mar 2006
Posts: 2
Reputation: []{evin is an unknown quantity at this point 
Solved Threads: 0
[]{evin []{evin is offline Offline
Newbie Poster

PHP Help - Display forum online and total members on main page

 
0
  #1
Mar 16th, 2006
Hey.. I've been trying for quite some time now to figure out how to display statistics from my phpbb forum on my main page which is just plain html. Now I've got so far that I have an iframe which will display a PHP file called member_stat.php ... The problem is with getting the php file to read the database and output the information. I was wondering if anyone here could help me with this problem by perhaps telling me how the php code should look or what I need to do to get it to display the info I want on my main page. :-|
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 354
Reputation: Troy is an unknown quantity at this point 
Solved Threads: 5
Troy's Avatar
Troy Troy is offline Offline
Posting Whiz

Re: PHP Help - Display forum online and total members on main page

 
0
  #2
Mar 17th, 2006
Here is a Daniweb thread where I show a code example to connect to a mysql db, select a db, create a query, execute it, and work with the resulting data.
http://www.daniweb.com/techtalkforum...=mysql_connect

There are a LOT of threads here on Daniweb in the PHP forum that will show you similar examples. You could also get almost the same code examples from the excellent PHP website.

PHP's MySQL Introduction
http://www.php.net/manual/en/ref.mysql.php

More specific code examples can be found by looking at the various mysql function documentation pages. For example, the mysql_fetch_array() documentation:
http://www.php.net/manual/en/functio...etch-array.php
Troy Wolf is the author of SnippetEdit. "Website editing as easy as it gets." IX Web Hosting
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 2
Reputation: []{evin is an unknown quantity at this point 
Solved Threads: 0
[]{evin []{evin is offline Offline
Newbie Poster

Re: PHP Help - Display forum online and total members on main page

 
0
  #3
Mar 17th, 2006
Hey I ment to close this... my mistake. I figured out what was wrong with my code I will show you what I came up with.

  1. <?php
  2.  
  3. // Defines the login information
  4. $host = "localhost";
  5. $database = "my_database_name";
  6. $username = "my_login";
  7. $password = "my_pass";
  8.  
  9. // Opens a connection and selects the database
  10. $connect = mysql_connect("$host", "$username", "$password");
  11. $db = mysql_select_db("$database");
  12.  
  13. // Create link identifier
  14. $link = mysql_connect("$host", "$username", "$password");
  15.  
  16. // Performs query selcting all fileds in the table in phpbb.. phpbb_users by default
  17. $result = mysql_query("SELECT * FROM phpbb_users", $link);
  18.  
  19. // Defined the number of rows
  20. $num_rows = mysql_num_rows($result);
  21.  
  22. // Since there is an anonymous account subtract 1
  23. $num_rows -= 1;
  24.  
  25. // Displays number of rows with my added font choice
  26. echo "<font face=Verdana size=1 color=484077> $num_rows </font>";
  27.  
  28. ?>

The problem I was having was with

  1. // Performs query selcting all fileds in the table
  2. $result = mysql_query("SELECT * FROM phpbb_users", $link);

but I got it now.. hope this serves useful to any phpbb users...
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC