Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-01-2002, 08:46 AM   PM User | #1
iSlak
New to the CF scene

 
Join Date: Oct 2002
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
iSlak is an unknown quantity at this point
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?
iSlak is offline   Reply With Quote
Old 10-01-2002, 08:54 AM   PM User | #2
Alekz
Regular Coder

 
Join Date: Sep 2002
Location: Bulgaria
Posts: 123
Thanks: 0
Thanked 0 Times in 0 Posts
Alekz is on a distinguished road
Hi,
I had a similar problem...
Try to repair the table, it helped in my case...

Alex
Alekz is offline   Reply With Quote
Old 10-01-2002, 09:03 AM   PM User | #3
iSlak
New to the CF scene

 
Join Date: Oct 2002
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
iSlak is an unknown quantity at this point
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>";


    } 
iSlak is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:00 PM.


Advertisement
Log in to turn off these ads.