Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Oct 2002
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Retreival Loop... won't stop retreiving!

    PHP Code:
        while ($row mysql_fetch_row($result)) {
         
         echo 
    $row[2];
         echo 
    "<input name=viewid type=radio value=$row[0]>";
         echo 
    "<br>";
         echo 
    "<br>";


        } 
    There are two records in the table I am querying. The loop displays both records, then continues to echo the second record infinitely.

    Or in other words... the loop won't stop running.


    Why is this?

  • #2
    Regular Coder
    Join Date
    Sep 2002
    Location
    Bulgaria
    Posts
    123
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi,
    I had a similar problem...
    Try to repair the table, it helped in my case...

    Alex

  • #3
    New to the CF scene
    Join Date
    Oct 2002
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I fixed the problem. I was using poor loop logic.

    I found a better loop...




    PHP Code:
        $numrows mysql_num_rows($result);
        
        for (
    $i =0$i $numrows$i++) {
         
         
    $row mysql_fetch_row($result);
         echo 
    $row[2];
         echo 
    "<input name=viewid type=radio value=$row[0]>";
         echo 
    "<br>";
         echo 
    "<br>";


        } 


  •  

    Posting Permissions

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