Jump to content

Recommended Posts

h i am making a forum and on he index its supposed to have a list of forums, i have that but when you clock a forum its supposed to link to a sub forum, the sub forum should show posts in a table forumtutorial_posts that have forumid to the same value as the forum is in. heres my code.

 

index.php

<HTML>

<body>

<TABLE style=BORDER-COLLAPSE: collapse borderColor=#77a7ad cellSpacing=1 cellPadding=1 width=100% bgColor=#ffffff border=1>

  <tr>

    <th width=100 height=25 nowrap=nowrap>Forum name</th>

  </tr>

<?php

 

include "connect.php"; //mysql db connection here

$result = mysql_query("SELECT forumname FROM forums");

if(mysql_num_rows($result)!= "")

{

  $stt=0;

  while ($row = mysql_fetch_array($result)) {

    $stt++;

    print "

  <tr>

    <td align=center><a href=/veiw_forum.php?forumid=$forumid><span>".$row['forumname']."</span></td></a>

  </tr>

";

  }

}

mysql_free_result($result);

?>

</table>

</body>

</HTML>

 

veiw_forum.php

<?php

include("include/session.php");

include "header.php";

include ("menu.php");

include "connect.php"; //mysql db connection here

 

print "<link rel='stylesheet' href='style.css' type='text/css'>";

print "<A href='post.php'>New Topic</a><br>";

 

print "<table class='maintable'>";

 

print "<tr class='headline'><td width=50%>Topic</td><td width=20%>Topic Starter</td><td>Replies</td><td>Last replied time</td></tr>";

print "</table>";

include("include/view_active.php");

include "footer.php";

?>

Link to comment
https://forums.phpfreaks.com/topic/63787-forum-issues/
Share on other sites

The code of the first part looks good, except if(mysql_num_rows($result)!= "") that will always be true. mysql_num_rows returns 0,1,2 etc not an empty value. Anyway thats not your problem. If the link to the subforum takes the correct id then im guessing that your problem is in view_active.php which we are not able to see as its included. Basically u need to get the id from url and make a query of all the sub forums that have that parent id.

Link to comment
https://forums.phpfreaks.com/topic/63787-forum-issues/#findComment-318007
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.