[RESOLVED] Mysql_num_rows & while(*************) {
ok so here's my code:
PHP 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:
Quote:
Originally Posted by Rudi's mind
I think that, because
PHP Code:
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:
Re: Mysql_num_rows & while(*************) {
Fixed using a different method.
:)
Re: Mysql_num_rows & while(*************) {
If its fixed can you mark your thread as resolved, Thanks
Re: Mysql_num_rows & while(*************) {
I had already clicked it :eek: