x
This website is using cookies. We use cookies to ensure that we give you the best experience on our website. More info. That's Fine
HPC:Factor Logo 
 
Latest Forum Activity

PHPBB to other-page

chazco
chazco Page Icon Posted 2006-03-08 2:15 PM
#
Status:
Hello,

On my website i have a PHPBB2 forum. I would like to pull the latest thread titles from this and display them on the homepage. Anyone know how to do this?

Thanks in advance...
 Top of the page
abyssknight
abyssknight Page Icon Posted 2006-03-08 2:18 PM
#
Status:
I could help, but I would need to find out what the PHPBB database tables look like. If you could post the posts table (create table or just column definitions) I could write the PHP. Are familiar are you with PHP/MySQL?
 Top of the page
chazco
chazco Page Icon Posted 2006-03-08 2:21 PM
#
Status:
Yes, the problem is that the homepage is already conencted to one other database. I dont know what the actual table i need is called i'm afraid.
 Top of the page
chazco
chazco Page Icon Posted 2006-03-08 2:23 PM
#
Status:
Sort of like HPCFactor does under "Community Forums" here - http://www.hpcfactor.com/
 Top of the page
abyssknight
abyssknight Page Icon Posted 2006-03-08 2:24 PM
#
Status:
I can probably google it. You can connect to more than one database on a page. You just have to set each connect equal to a variable and pass it in on all the queries. Might be too much, but it can be done.

UPDATE: This might help. PHPBB Doctor: Table Structure

Edited by abyssknight 2006-03-08 2:25 PM
 Top of the page
abyssknight
abyssknight Page Icon Posted 2006-03-08 2:34 PM
#
Status:
This is very rough, but basically you could do the following. (The code below only lists the topics of the last 10 replies/posts in an unordered list. The database connect isn't listed either, this is just for demonstration and is horribly untested.)

$getPosts = mysql_query("select a.post_time, b.topic_title from phpbb_posts as a, phpbb_topics as b where a.topic_id = b.topic_id order by a.post_time desc limit 10" or die(print("There has been an error." print("<ul>"; while($row = mysql_fetch_array($getPosts,MYSQL_ASSOC)){ print("<li>".$row['topic_title']."</li>"; } print("</ul>";


Edited by abyssknight 2006-03-08 2:34 PM
 Top of the page
chazco
chazco Page Icon Posted 2006-03-08 2:37 PM
#
Status:
Okay - i'm trying to find out what to do to connect to two MySql databases at the moment, so i'll try it then.

Thanks again.
 Top of the page
abyssknight
abyssknight Page Icon Posted 2006-03-08 2:54 PM
#
Status:
How you do it is simple:

$db1 = mysql_connect( ... );
mysql_select_db(...);

$db2 = mysql_connect( ... );
mysql_select_db(...);

mysql_query( "query here" ,$db1)

Where $db1 is the db that query is for.
 Top of the page
chazco
chazco Page Icon Posted 2006-03-08 4:43 PM
#
Status:
Okay, i've got this:

$phpbb_conn=mysql_connect ("localhost", USERNAME, PASSWORD) or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db(DATABASENAME) or die(mysql_error()); $getPosts = mysql_query("select a.post_time, b.topic_title from phpbb_posts as a, phpbb_topics as b where a.topic_id = b.topic_id order by a.post_time desc limit 3", $phpbb_conn); print("<p>"; while($row = mysql_fetch_array($getPosts, MYSQL_ASSOC)){ print("<a href=\"forum/viewtopic.php?t=".$row['topic_id']."\" target=\"_top\">".$row['topic_title']."</a><br>"; } print("</p>";


Now, that works apart from the link. Any ideas? (i'm new to MySql)

Edited by chazco 2006-03-08 4:44 PM
 Top of the page
C:Amie Page Icon Posted 2006-03-08 4:51 PM
#
Avatar image of C:Amie
Administrator
H/PC Oracle

Posts:
17,991
Location:
United Kingdom
Status:
erm, not that I would ever want to stand in the way of devleoper growth... but what has this got to do with H/PC development?
Latest Topics Mod: http://www.phpbbhacks.com/download/680
 Top of the page
chazco
chazco Page Icon Posted 2006-03-08 5:21 PM
#
Status:
Sorry, i though it was development for anything (and it is for a Jornada Linux forum)...
 Top of the page
abyssknight
abyssknight Page Icon Posted 2006-03-08 5:49 PM
#
Status:
Either way, feel free to PM me if you need a hand.
 Top of the page
Jump to forum:
Seconds to generate: 2.437 - Cached queries : 42 - Executed queries : 25