Jump to content


Photo

Forum


  • Please log in to reply
1 reply to this topic

#1 SieRobin

SieRobin
  • Members
  • PipPipPip
  • Advanced Member
  • 212 posts
  • LocationNew Jersey

Posted 07 March 2006 - 02:18 AM

I'm creating a forum on my website.. all from scratch. Now I'm stuck on this part, I can't seem to figure it out, but perhaps you all could help me out with this. I want all the code in one page, because I don't want to use a million pages for the forum, so I'm using if/else statements in order to display the threads and board names. Here is the script I've written up.

<?php
session_start();
include 'connect.php';
?>
<link rel="stylesheet" href="style.css" type="text/css">
<title>Feudal Age - Forum</title>
<?php
include "navigate.php";
if (isset($_SESSION['player'])) 
  { 
  $player=$_SESSION['player'];
  $userstats="SELECT * from users where playername='$player'";
  $userstats2=mysql_query($userstats) or die("Could not retrieve the users stats.");
  $userstats3=mysql_fetch_array($userstats2);
  $brd=$_GET['brd'];
    if ($brd==) {   
         $thread="SELECT * from f_thread where bname='$brd' order by ID ASC";
          $thread2=mysql_query($thread) or die ("Could not display threads");  
        print "<table class='table'><tr class='headline'><td colspan='5'><center>Forum</center></td></tr>
        <tr class='headline'><td>Thread</td><td>Author</td><td>Last Poster</td><td>Replies</td><td>Views</td>";
        while ($thread3=mysql_fetch_array($thread2)) {
        print "<tr class='mainrow'><td><a href='forum.php?brd=1&msg=$thread3[ID]'>$thread3[title]</a></td>
        <td><a href='profile.php?id=$userstats3[ID]'>$thread3[author]</center></td><td>$thread3[lastpost]</td><td>$thread3[replies]</td>
        <td>$thread3[views]</td></tr>";
        }
        print "</table>";
        } else {
    $forum="SELECT * from f_forum order by ID ASC";
    $forum2=mysql_query($forum) or die("Could not retrieve the users stats.");
    print "<table class='table'><tr class='headline'><td colspan='4'><center>Forum</center></td></tr>
    <tr class='headline'><td>Board Name</td><td>Description</td></tr>";
    while ($forum3=mysql_fetch_array($forum2)) {
    print "<tr class='mainrow'><td><a href='forum.php?brd=$forum3[bname]'>$forum3[fname]</a></td><td>$forum3[desc]</td></tr>";
    }
    print "</table>";
    }
  }
?>

Ok, so this line..

$brd=$_GET['brd'];
    if ($brd==) {  

I want to be able to like.. display that boards threads without having to put..

if ($brd=="gen") { 
do something }


I just want it to be able to know which board it's on and to show it's threads, anyone know how to do this? If you don't get what I'm saying I'll try and rephrase it.

#2 SieRobin

SieRobin
  • Members
  • PipPipPip
  • Advanced Member
  • 212 posts
  • LocationNew Jersey

Posted 07 March 2006 - 02:29 AM

EDIT: Problem fixed :] delete post please :D




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users