..:RUDI:..
Apr 11th, 2006, 10:31 AM
ok so here's my code:
<?
$threadquery = "SELECT * FROM threads WHERE fid = $forumid";
$threadresult = mysql_query($threadquery);
while ($row = mysql_fetch_assoc($threadresult)) {
$tid = $row['topicid'];
$postquery = mysql_query("SELECT * FROM posts WHERE tid = '".$row['topicid']."';");
}
$countposts = mysql_num_rows($postquery);
echo $countposts ;
?>
from that, I only get 1 result from the num_rows. However, there are two threads, each with a reply, therefore, the post count should be 2.
What I think is happening:
I think that, because while ($row = mysql_fetch_assoc($threadresult)) {
$tid = $row['topicid']; produces an array of numbers for ech thread, maybe the mysql_num_rows() is only getting one of the array members, possibly I could use for each???
Any help is greatly appreciated.
Regards,
Rudi
:cool:
<?
$threadquery = "SELECT * FROM threads WHERE fid = $forumid";
$threadresult = mysql_query($threadquery);
while ($row = mysql_fetch_assoc($threadresult)) {
$tid = $row['topicid'];
$postquery = mysql_query("SELECT * FROM posts WHERE tid = '".$row['topicid']."';");
}
$countposts = mysql_num_rows($postquery);
echo $countposts ;
?>
from that, I only get 1 result from the num_rows. However, there are two threads, each with a reply, therefore, the post count should be 2.
What I think is happening:
I think that, because while ($row = mysql_fetch_assoc($threadresult)) {
$tid = $row['topicid']; produces an array of numbers for ech thread, maybe the mysql_num_rows() is only getting one of the array members, possibly I could use for each???
Any help is greatly appreciated.
Regards,
Rudi
:cool: