|
-
Apr 11th, 2006, 10:31 AM
#1
Thread Starter
Hyperactive Member
[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:
 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
-
Apr 12th, 2006, 02:49 AM
#2
Thread Starter
Hyperactive Member
Re: Mysql_num_rows & while(*************) {
Fixed using a different method.
-
Apr 12th, 2006, 03:11 AM
#3
<?="Moderator"?>
Re: Mysql_num_rows & while(*************) {
If its fixed can you mark your thread as resolved, Thanks
-
Apr 12th, 2006, 06:26 AM
#4
Thread Starter
Hyperactive Member
Re: Mysql_num_rows & while(*************) {
I had already clicked it
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|