| | |
PHP Help - Display forum online and total members on main page
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Mar 2006
Posts: 2
Reputation:
Solved Threads: 0
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/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
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
•
•
Join Date: Mar 2006
Posts: 2
Reputation:
Solved Threads: 0
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.
The problem I was having was with
but I got it now.. hope this serves useful to any phpbb users...
PHP Syntax (Toggle Plain Text)
<?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
PHP Syntax (Toggle Plain Text)
// 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...
![]() |
Similar Threads
- Main Page Description Change, how often does Google update its search engine. (Search Engine Optimization)
- Help with switch/case statement navigation (PHP)
- My main page is "http://rl.webtracer.cc/-/?bayzm" no matter what i do to change it... (Viruses, Spyware and other Nasties)
- Generating Registered Forum Users (Growing an Online Community)
- My forum is not growing -- and I'm tired and drained literally (Website Reviews)
Other Threads in the PHP Forum
- Previous Thread: Reading file names from a folder
- Next Thread: testing php
| Thread Tools | Search this Thread |
apache api array beginner binary body broken buttons cakephp checkbox class cms code cron curl database date date/time display dynamic ebooks echo email error file files folder form forms function functions global google href htaccess html image include insert ip javascript joomla limit link list login mail mediawiki menu mlm msqli_multi_query multiple mycodeisbad mysql number oop parameter paypal pdf php phpincludeissue problem query radio random recourse recursion regex remote script search seo server sessions sms source sp space speed sql static subdomain syntax system table tag tutorial update upload url validator variable vbulletin video web webdesign white wordpress xml youtube





