I am in need of help i been bashing my head on the desk for 3 days straight on trying to get this script working..
I need it to count how many topics & posts there are in each category.. here is the script i got so far (its not all there but its all you should need)..
<?php
$id = $_GET['id'];
$sql = mysql_query("SELECT * FROM header ORDER BY `id`");
while($rows = mysql_fetch_array($sql)){
$id = $rows['id'];
$a_id = $rows['id'];
$datetime = date('D dS M Y, h:i a', strtotime($rows['datetime']));
$get_num_topics = "select count(forumid) from forum_question where id = $id";
$get_num_topics_res = mysql_query($get_num_topics) or die(mysql_error());
$topics = mysql_result($get_num_topics_res,0,'count(forumid)');
$get_num_posts = "select count(question_id) from forum_answer where a_id = $a_id";
$get_num_posts_res = mysql_query($get_num_posts) or die(mysql_error());
$posts = mysql_result($get_num_posts_res,0,'count(question_id)');
?>
<tr>
<td width="80%"><a href="../index.php?pages=topic&id=<?php echo $rows['id']; ?>"><?php echo $rows['heading']; ?></a><BR> <?php echo $rows['description']; ?></td>
<td width="10%" align="center"><?php echo $topics; ?></td>
<td width="10%" align="center"><?php echo $posts; ?></td>
</tr>
Can someone please help me
Thank you
Smackie