sunrize Posted June 1, 2009 Share Posted June 1, 2009 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. Quote Link to comment Share on other sites More sharing options...
mrdamien Posted June 1, 2009 Share Posted June 1, 2009 You have to run in on a server with php, browsers don't parse the PHP. I see you have cpanel open, so I'm assuming you have a shared hosting somewhere, upload it there to test. Quote Link to comment Share on other sites More sharing options...
sunrize Posted June 1, 2009 Author Share Posted June 1, 2009 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 Quote Link to comment Share on other sites More sharing options...
sunrize Posted June 4, 2009 Author Share Posted June 4, 2009 ive been tinkering with it still but im still having trouble. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.