WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Adding a Latest Threads Section to your website
Categories : PHP, Miscellaneous
bastien koert
Date : Dec 02nd 2004
Grade : 3 of 5 (graded 4 times)
Viewed : 4926
File : No file for this code example.
Images : No Images for this code example.
Search : More code by bastien koert
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

I was recently asked how to add a listing (such as the one on the right) of recent PHPBB posts to a website...here it is

As always, its easily customizable to suit your needs of what you want to display (in this case its just the subject as a link)

Regards

Bastien

<?
$sql   
= '';
$limit = 10;          //default number of posts to show change it to show more or fewer recent posts
$path  = 'phpbb2';    //default path to the phpbb folder in your site
                    //this assumes it is one deeper that this page
                    //change it to match your site's layout

// Connect to your database: Fill in the elements below
$db = mysql_connect("localhost", "user", "pass") or die("Unable to connect to mysql.".mysql_error());

//phpbb is the default phpbb db name, change it if it is not correct
mysql_select_db ("phpbb",$db) or die("Unable to select database".mysql_error());

// Select the info you need from your table.
$sql = "SELECT a. * , b.post_time
        FROM phpbb_posts_text a, phpbb_posts b
        WHERE a.post_id = b.post_id
        ORDER BY post_time DESC
        LIMIT
$limit";

$result=mysql_query($sql) or die("Unable to select news.".mysql_error());

while(
$row = mysql_fetch_array($result)){

   
// echo out entry here
    // column_name is the name of the column in the database
   
echo "Subject: <a href=\"$path/viewtopic.php?p=".$row['post_id']."#".$row['post_id']."\">".$row["post_subject"]."</a><br>";
}

// Now disconnect from the database.
mysql_close($db);
?>



Query2Report : Generating Html, Pdf and Csv Reports from SQL Query
Categories : PHP, PHP, HTML, PDF, Excel
What does PHP stand for?
Categories : Miscellaneous, PHP
This is a simple PHP3 script to send an instant msg to the webmaster (only for Windows NT).
Categories : PHP, Misc, Miscellaneous
How to display any array in several rows and columns of a table. Not just in one column or in alternate rows. This example shows a nice color table generated with PHP, but can be used with any array values(e.g. Database)
Categories : Arrays, PHP, Miscellaneous, Beginner Guides, Graphics
Invision Forums Latest Threads list
Categories : PHP, Miscellaneous, Databases, MySQL
icq status checker online offline disabled unknown
Categories : PHP, Miscellaneous
chdir -- change directory
Categories : PHP, PHP Functions, Directories
REALTIME SHIPPING QUOTE
Categories : Complete Programs, Ecommerce, PHP
A script to generate a report from a valid mysql connection. The user has to supply which fields he wants to display in table. All properties are changable.
Categories : PHP, PHP Classes, Databases, MySQL, HTML and PHP
Why do i get a Save As dialog box when I type in the url of a php3 file
Categories : PHP Configuration, PHP, Apache, Web Servers
Simple PHP control CSS Calendar
Categories : PHP, HTML and PHP, Calendar, Date Time, CSS
CrowFTP is a utility that maintains your web site up to date. It's a set of Unix shells that automatically updates your Web site using FTP.
Categories : Content Management, Site Planning, Complete Programs, Miscellaneous, Utilities
PHP class generator, must be used from Command line interface.
Categories : PHP, PHP Classes, Shell Scripting
Automatically printing the contents of an sql table in MySQL.
Categories : MySQL, PHP, HTML and PHP, Databases
XPertMailer - Sends TRUE Mails
Categories : PHP, Mail, SMTP, PHP Classes