loony383 Posted August 7, 2007 Share Posted August 7, 2007 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"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/63787-forum-issues/ Share on other sites More sharing options...
frost Posted August 7, 2007 Share Posted August 7, 2007 Can you post the code for - include("include/view_active.php"); Also if you have a live demo that would make it easier to debug a problem. Quote Link to comment https://forums.phpfreaks.com/topic/63787-forum-issues/#findComment-317983 Share on other sites More sharing options...
Fadion Posted August 8, 2007 Share Posted August 8, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/63787-forum-issues/#findComment-318007 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.