Hi all:
I just took over a new position and learning PHP at my company. We have a forum and currently it list the topic or thread of the most recent thread answered. I need it to list out all the threads in the forum that are there period. How do I do this?
The current code is
PS the person who wrote this is no longer with the company)...
Thanks
Z
I just took over a new position and learning PHP at my company. We have a forum and currently it list the topic or thread of the most recent thread answered. I need it to list out all the threads in the forum that are there period. How do I do this?
The current code is
Code:
$forum_sql="select forum_id from $tb_forums where forum_lock='y'";
$forum_qry=mysql_query($forum_sql) or die(mysql_error());
$forum_res_cnt=mysql_num_rows($forum_qry);
$fcnt=1;
while( $forum_res=mysql_fetch_array($forum_qry))
{
$forum_res_qry.="forum_id<> ".$forum_res[0];
if ($fcnt < $forum_res_cnt) { $forum_res_qry .=" and ";}
$fcnt++;
}
if ($forum_res_cnt>0) { $where=" where $forum_res_qry "; }
$sql = "
select
*
from
$tb_threads
$where
order by
timestamp desc limit 0,$num_lastlog_image
";
$query = mysql_query($sql) or die(mysql_error());
$forum_topics = "<tr><td><table width=100%><tr>
<td><br></td>
</tr>
<tr><td width=100%>
<table border=1 width=100% cellspacing=0 cellpadding=0>
<tr><td class=s10 width=100% colspan=2> <b>Forum Topics</b></td></tr>
<tr><td width=50%> <table border=0 width=100% cellspacing=0 cellpadding=0>
";
while($array = mysql_fetch_array($query))
{
$alt = $i % 2 ? "alt1" : "alt2";
$i++;
$thread_name = get_thread_name($array["thread_id"]);
$forum_topics.="<tr><td class=s10 width=100%>
<a href=\"$base_url/posts.php?t=$array[thread_id]\">$thread_name</a></td></tr>";
}
$forum_topics.="</table></td>
<td width=50%> <table border=0 width=100% cellspacing=0 cellpadding=0> ";
$sql = "
select
*
from
$tb_threads
$where
order by
timestamp desc limit 10,10
";
$query = mysql_query($sql) or die(mysql_error());
while($array = mysql_fetch_array($query))
{
$alt = $i % 2 ? "alt1" : "alt2";
$i++;
$thread_name = get_thread_name($array["thread_id"]);
$forum_topics.="<tr><td class=s10 width=100%>
<a href=\"$base_url/posts.php?t=$array[thread_id]\">$thread_name</a></td></tr>";
}
$forum_topics .="</table> </td> </tr></table></td></tr>
<tr><td><br></td></tr>
";
Z