Results 1 to 4 of 4

Thread: [RESOLVED] Mysql_num_rows & while(*************) {

  1. #1

    Thread Starter
    Hyperactive Member ..:RUDI:..'s Avatar
    Join Date
    Aug 2005
    Location
    Yorkshire, England! c0d: Da Vinci
    Posts
    344

    Resolved [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



    My Personal Home | MageBB Home | Elders Online
    Yes, Noteme is my father.

  2. #2

    Thread Starter
    Hyperactive Member ..:RUDI:..'s Avatar
    Join Date
    Aug 2005
    Location
    Yorkshire, England! c0d: Da Vinci
    Posts
    344

    Re: Mysql_num_rows & while(*************) {

    Fixed using a different method.



    My Personal Home | MageBB Home | Elders Online
    Yes, Noteme is my father.

  3. #3
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099

    Re: Mysql_num_rows & while(*************) {

    If its fixed can you mark your thread as resolved, Thanks

  4. #4

    Thread Starter
    Hyperactive Member ..:RUDI:..'s Avatar
    Join Date
    Aug 2005
    Location
    Yorkshire, England! c0d: Da Vinci
    Posts
    344

    Re: Mysql_num_rows & while(*************) {

    I had already clicked it



    My Personal Home | MageBB Home | Elders Online
    Yes, Noteme is my father.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width