Jump to content

Retrieving data from existing forum such as SMF to your site


sunrize

Recommended Posts

Im having some toruble with some coding. I have a website i made and i have a forum. I want to take certain boards from the forum and display it on my main page. I want the subject and the poster name so it looks like the following : Subject - Name of poster. Here is my coding

 

<?php

 

$dbh = mysql_connect("localhost","team_del_smf1","stanton2") or die (mysql_error());

$db = mysql_select_db("team_del_smf1");

 

$query = mysql_query("SELECT `ID_TOPIC` FROM `smf_topics` WHERE `ID_BOARD`='8' ORDER BY `ID_LAST_MSG` DESC LIMIT 8");

while(list($ID_TOPIC) = @mysql_fetch_array($query))

{

$query2 = mysql_query("SELECT `subject`, `posterName` FROM `smf_messages` WHERE `ID_TOPIC`='$ID_TOPIC'");

list($subject, $posterName) = @mysql_fetch_array($query2);

 

$scenenews .=<a href=\"/forums/index.php/topic,$ID_TOPIC.2.html\" class=\"Index_03\">$subject</a><br/>";

}

 

 

 

?>

 

I named this functions.php. Then in my index at very top i put

<?php

session_start();

include "./functions.php";

 

?>

 

Now in my codding u can see i put class="Index_03". SO in my index i made this

 

<div class="Index_03">

<?php include "functions.php"; ?>

</div>

 

 

i have no clue if this is right or not but i know i have to include something in the class its either that or $. Someone please help.

 

this is what i get when you see my page. this is where the data is supposed to come up. next to it is my source.  81373391.jpg

Link to comment
Share on other sites

i ran it on my server, ive been tinkering with it and it still doesnt work. when i made a seperate file for my functions then do a include on my index , most of my fields are missing and i get an error inside one of my content fields.

 

 

I have this inside my div like so:

 

<div id="name">

<?php

 

$dbh = mysql_connect("localhost","team_del_smf1","stanton2") or die (mysql_error());

$db = mysql_select_db("team_del_smf1");

 

$query = mysql_query("SELECT `ID_TOPIC` FROM `smf_topics` WHERE `ID_BOARD`='8' ORDER BY `ID_LAST_MSG` DESC LIMIT 8");

while(list($ID_TOPIC) = @mysql_fetch_array($query))

{

$query2 = mysql_query("SELECT `subject`, `posterName` FROM `smf_messages` WHERE `ID_TOPIC`='$ID_TOPIC'");

list($subject, $posterName) = @mysql_fetch_array($query2);

 

$scenenews .=<a href=\"/forums/index.php/topic,$ID_TOPIC.2.html\" class=\"Index_03\">$subject</a><br/>";

}

 

 

 

?>

</div>

 

on top of my index i have a php include but i realized theres no point cause its not a seperate file anymore so idk what to do. i need help with the coding i have.

my email/msn is sun_rize@live

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.