...

View Full Version : Retreival Loop... won't stop retreiving!



iSlak
10-01-2002, 09:46 AM
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?

Alekz
10-01-2002, 09:54 AM
Hi,
I had a similar problem...
Try to repair the table, it helped in my case...

Alex

iSlak
10-01-2002, 10:03 AM
I fixed the problem. I was using poor loop logic.

I found a better loop...






$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>";


}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum