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
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
פרייסז - השוואת מחירים בסופר
ZeroLag.com
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 : 5244
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);
?>



What does PHP stand for?
Categories : Miscellaneous, PHP
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
Query2Report : Generating Html, Pdf and Csv Reports from SQL Query
Categories : PHP, PHP, HTML, PDF, Excel
icq status checker online offline disabled unknown
Categories : PHP, Miscellaneous
This is a simple PHP3 script to send an instant msg to the webmaster (only for Windows NT).
Categories : PHP, Misc, Miscellaneous
A File Browser Class.To Read Drives,Directories and Files .Files writing is also possible
Categories : PHP, PHP Classes, Filesystem
Using select multiple with php3
Categories : HTML and PHP, PHP
How can I know about what Operating System is running on server from PHP?
Categories : PHP, Global Variables
How to build a search query for any N number of words in a search string
Categories : PHP, Regexps, Search Engines, Search
Specify your connection settings and create a link to a MySQL database.
Categories : PHP, PHP Classes, Databases, MySQL, Beginner Guides
myCSV-dump converts a simple CSV-flatfile-database into an MySQL-dump.
Categories : PHP, MySQL, Databases, Complete Programs
An SQL Administration User Interface for the Web
Categories : Databases, PHP, mSQL, Complete Programs
This PHP function creates dropdown select lists for time and date that you can change, outputs a 14 char MySQL timestamp in a text field
Categories : PHP, MySQL, Java Script, HTML and PHP
Upload Via FTP - an alternative to move_uploaded_file
Categories : PHP, FTP, Beginner Guides