Obtaining and displaying info on main site page.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
camarosource
Forum Commoner
Posts: 77
Joined: Sat Aug 03, 2002 10:43 pm

Obtaining and displaying info on main site page.

Post by camarosource »

I have some PHP programs that use MYSQL Databases.

I would like to display a number of information from my phpbb message board and other PHP programs on my main website page.

How would I go about doing this? Any example script would be MUCH appreciated. Anything you can help with with be great. Thanks
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

[php_man]mysql_fetch_array[/php_man] is a place where you would be best of starting at (that and the other links on the left side of that page).

Don't forget the usercomments on those pages also. I could post some sample code, what it would require you to read up on the functions I use in the end anyway, so pointing you to the manual seems like the better idea for now.

Have fun.
camarosource
Forum Commoner
Posts: 77
Joined: Sat Aug 03, 2002 10:43 pm

Post by camarosource »

Sample code would be much appreciated.
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

Code: Select all

<?php
// connect
   $link = mysql_connect("localhost", "mysql_user", "mysql_password") or die("Could not connect: " . mysql_error());
// select something
   $result = mysql_query("SELECT count(users) FROM bbboard.users") or die("Could not query:" . mysql_error());
// display the info
   echo mysql_result($result, 0); // count()'ed users in the database
// close the connection
   mysql_close($link);
?>
User avatar
DuFF
Forum Contributor
Posts: 495
Joined: Tue Jun 24, 2003 7:49 pm
Location: USA

Post by DuFF »

I needed to do the exact samething and found that there was actually a phpBB mod that can help with it. Check out phpBB Fetch All
Post Reply