Page 1 of 1

Obtaining and displaying info on main site page.

Posted: Sun Jan 04, 2004 3:34 am
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

Posted: Sun Jan 04, 2004 5:52 am
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.

Posted: Sun Jan 04, 2004 5:58 am
by camarosource
Sample code would be much appreciated.

Posted: Sun Jan 04, 2004 6:02 am
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);
?>

Posted: Sun Jan 04, 2004 10:28 am
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