+ Reply to Thread
Results 1 to 3 of 3
Thread: phpBB latest post script.
-
08-20-2009 07:19 PM #1Senior Member
- Join Date
- May 2008
- Posts
- 248
phpBB latest post script.
Okay, Maybe you guys know better than me, with google searches and such. But I honestly couldn't find a really easy copy and code code for 10 most recent topics. So I coded this and here you go.
Its basic, I know. If it was too advanced people would come here and be confused, I prefer releasing code people can copy, paste, and thank.
#Class_MySQL.php
#TopTen.phpPHP Code:<?php
class C_MySQL
{
function Query( $sql )
{
mysql_connect( "dbhost", "dbuser", "dbpassword" );
mysql_select_db( databasename );
return mysql_query ( $sql );
}
}
?>
PHP Code:<?php
require_once("class_mysql.php");
$sql = new C_MySQL;
echo "<body link=blue vlink=blue alink=blue>";
$result = $sql->Query("SELECT `forum_id`, `topic_id` , `topic_title` , `topic_poster` , `topic_time` FROM `phpbb_topics` ORDER BY topic_time DESC LIMIT 10");
if ( mysql_num_rows( $result ) > 0 )
{
while ( $row = mysql_fetch_array( $result ) )
{
echo "<font face=Verdana><a href=your_site_url/your_forum_folder/viewtopic.php?f=". $row['forum_id'] . "&t=" . $row['topic_id'] . ">" . $row['topic_title']. "</a>";
echo "<br>";
}
}
else
{
die(mysql_error());
}
?>Currently deployed in support of OEF XI-XII
-
09-12-2009 07:36 PM #2Site Technician
- Join Date
- Apr 2008
- Posts
- 76
-
09-24-2009 06:35 PM #3Senior Member
- Join Date
- May 2008
- Posts
- 248
I r look in the database and it r seem logical which tables to use <3phpmyadmin
Currently deployed in support of OEF XI-XII


LinkBack URL
About LinkBacks



Reply With Quote

