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. :-|

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/techtalkforums/showthread.php?t=25316&highlight=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/function.mysql-fetch-array.php

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.

<?php

// Defines the login information
$host = "localhost";
$database = "my_database_name";
$username = "my_login";
$password = "my_pass";

// Opens a connection and selects the database
$connect = mysql_connect("$host", "$username", "$password");
$db = mysql_select_db("$database");

// Create link identifier
$link = mysql_connect("$host", "$username", "$password");

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

// Defined the number of rows
$num_rows = mysql_num_rows($result);

// Since there is an anonymous account subtract 1
$num_rows -= 1;

// Displays number of rows with my added font choice
echo "<font face=Verdana size=1 color=484077> $num_rows </font>";

?>

The problem I was having was with

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

but I got it now.. hope this serves useful to any phpbb users... :D

This article has been dead for over six months. Start a new discussion instead.